Judge Newcomer ordered that Mr. Stinson, a 49-year-old former assistant deputy mayor of Philadelphia, be removed from his State Senate office and that Mr. Marks, a 36-year-old lawyer and former aide to United States Senator Arlen Specter, be certified the winner within 72 hours.

"This is extraordinary relief," Judge Newcomer wrote. "However, it is appropriate because extraordinary conduct by the Stinson campaign and the board tainted the entirety of the absentee ballots."

The two parties agreed that Mr. Marks would not try to enforce the order and take his seat until the United States Court of Appeals for the Third Circuit here reviewed an appeal that Mr. Stinson said he planned to file on Tuesday.

At stake is the result of a special election held last November to fill the seat made vacant by the death of a Democratic senator. The election was crucial because the party that won the seat also won control of the 50-member State Senate.

The judge decided to hear the case after state election officials and state courts rejected the Republicans' claims. The Republicans have an appeal pending before the state's highest court. They went to Federal court on the ground that there were violations of the Voting Rights Act and Civil Rights Act.

The Democrats, fearing that the court would rule against them, suddenly adjourned the State Senate on Monday, two days ahead of schedule. But when the Senate reconvenes next month, barring any successful Democratic appeal, Republicans will control the Senate by outnumbering Democrats by 26 to 24.

Republican leaders minimized the effect of today's ruling, saying they were eager to work with Gov. Robert P. Casey, a Democrat, on reforming the state's health care and welfare systems.