A federal judge in Pittsburgh ruled against President Donald Trump’s campaign Saturday in a lawsuit challenging Pennsylvania’s rules for mail voting and poll watchers, the latest legal setback for the president in a flurry of election-related litigation.

The lawsuit against Pennsylvania questioned the use of mail-ballot drop boxes, sought to require signature analysis for mail ballots, and argued that poll watchers for candidates and parties should be permitted to observe polling places in counties other than where they are registered to vote.

U.S. District Judge J. Nicholas Ranjan, a Trump appointee, ruled that the campaign did not prove a serious threat of voter fraud, and rejected its arguments on all three issues.

“While plaintiffs may not need to prove actual voter fraud, they must at least prove that such fraud is ‘certainly impending,’” Ranjan wrote in his 138-page opinion. “They haven’t met that burden.

“At most, they have pieced together a sequence of uncertain assumptions,” he added.

The ruling marked the second loss in court this week for the campaign. A Philadelphia judge ruled Friday that poll watchers don’t have a right to observe activity in satellite election offices where voters can apply for, complete, and return mail ballots.

Both lawsuits are part of a broader effort by Trump to attack mail voting and cast doubt on the integrity of the election, despite no evidence of widespread problems or fraud. Trump himself drew attention to Pennsylvania and Philadelphia during last month’s presidential debate when he said “bad things happen in Philadelphia.” This is the first year any Pennsylvania voter can cast a ballot by mail.

While the lawsuit was a loss for the campaign’s effort to limit mail voting, Trump campaign lawyer Matthew Morgan maintained Saturday that “the president is winning the fight for a free, fair election in Pennsylvania.” The campaign plans to appeal Ranjan’s ruling to the U.S. Court of Appeals for the Third Circuit, Morgan said.

Morgan also pointed to victories in a Pennsylvania Supreme Court ruling last month on other voting rules. That ruling said so-called naked ballots, submitted without inner secrecy envelopes, could not be counted. And the state’s high court also ruled that third-party groups cannot collect and return mail ballots — a practice Trump allies have called “ballot harvesting.”

The federal lawsuit in which Ranjan ruled Saturday had been put on hold earlier this year pending the state Supreme Court ruling. Pennsylvania’s high court also ruled against the Trump campaign on drop boxes and poll watchers. It also extended the deadline for mail ballots, saying those received up to three days after the Nov. 3 election must be counted, as long as there isn’t evidence, like a postmark, that they were mailed after Election Day.

The Pennsylvania Department of State, which oversees elections, has said mail ballots cannot be rejected simply because the signatures on them do not match the signature put on file when a voter registered.

The League of Women Voters of Pennsylvania, which intervened in the federal lawsuit to advocate for drop boxes, celebrated Saturday’s ruling.

“It is unconscionable to consider limiting drop boxes during a deadly pandemic, when the focus should be on expanding safe voting options — not restricting them further,” said Terrie Griffin, a co-president of the group.

Pennsylvania Attorney General Josh Shapiro, a Democrat, called Saturday’s ruling a victory for voters.

“We have been in court for months protecting the right to vote and working to get this outcome for all of you,” he said. "Vote by mail or in person, however you choose. Your vote will count.”