By Steve Gorman

(Reuters) - A judge refused on Friday to halt a four-day-old bus and rail strike in Philadelphia, denying a back-to-work petition by transit officials who argued the walkout endangered public welfare, according to both sides in the labor dispute.

A spokeswoman for the Southeastern Pennsylvania Transportation Authority (SEPTA), Carla Showell-Lee, said the agency "looks forward to the opportunity to resume testimony in court on Monday morning, but declined to otherwise comment.

A spokesman for Transport Workers Union Local 234, Jamie Horwitz, said the judge's denial was no surprise, calling the transit agency's bid for a preliminary injunction a "long shot."

Courts are generally reluctant to halt strikes.

The union earlier denounced the agency's petition to a state Common Pleas Court as a "pointless" legal maneuver that would only distract from talks aimed at settling the dispute.

The walkout by 4,700 transit workers has idled buses, trolleys and trains that provide some 930,000 rides a day in the fifth most populous city in the United States.

The union declared a strike on Monday night after contract talks with SEPTA stalemated over such issues as healthcare and pension benefits.

In seeking a back-to-work court order, SEPTA cited a Pennsylvania statute that prohibits any labor strike that "creates a clear and present danger or threat to the health, safety or welfare of the public."

It said the strike posed a particular hardship for 52,000 public school students who rely on SEPTA to get to and from classes, as well as for the city's poor and working-class residents. More than half of SEPTA riders earn less than $50,000 a year, and many take two or even three modes of public transit daily, the agency said.

"Those individuals cannot afford to switch to taxis (or) ride-sharing services," the lawsuit said. "News reports have shown people walking literally miles to get to work."

The agency also said a continuation of the strike through Election Day on Tuesday could hamper voter turnout.

Pennsylvania is a key swing state in the presidential campaign between Democrat Hillary Clinton and Republican Donald Trump. Philadelphia is a stronghold of the Democratic Party.

TWU Local 234 President Willie Brown said the focus should remain on negotiations, where "only a handful of issues" stand in the way of reaching an agreement.

Both sides said talks were continuing.

(Reporting by Joseph Ax in New York and Steve Gorman in Los Angeles; Editing by Diane Craft and James Dalgleish)