With the election coming to a close, the Trump and Biden campaigns, voting rights organizations and conservative groups are raising money and dispatching armies of lawyers for what could become a state-by-state, county-by-county legal battle over which ballots will ultimately be counted.

The deployments — involving hundreds of lawyers on both sides — go well beyond what has become normal since the disputed outcome in 2000, and are the result of the open efforts of President Donald Trump and the Republicans to disqualify votes on technicalities and baseless charges of fraud at the end of a campaign in which the voting system has been severely tested by the coronavirus pandemic.

In the most aggressive moves to knock out registered votes in modern memory, Republicans have already sought to nullify ballots before they are counted in several states that could tip the balance of the Electoral College.

In an early test of one effort, a federal judge in Texas on Monday ruled against local Republicans who wanted to compel state officials to throw out more than 127,000 ballots cast at newly created drive-through polling places in the Houston area. The federal court ruling, which Republicans said they would appeal, came after a state court also ruled against them.

In key counties in Nevada, Michigan and Pennsylvania, Republicans are seeking, with mixed results so far, to force election board offices to give their election observers more open access so they can more effectively challenge absentee ballots as they are processed, a tactic Republicans in North Carolina are seeking to adopt statewide.

And everywhere, in a year that has seen record levels of early voting and a huge surge in use of voting by mail, Republicans are gearing up to challenge ballots with missing signatures or unclear postmarks.

In his last days of campaigning, Trump has essentially admitted that he does not expect to win without going to court. "As soon as that election is over," he told reporters over the weekend, "we're going in with our lawyers."

Trailing consistently in the polls, Trump in that moment said out loud what other Republicans have preferred to say quietly, which is that his best chance of holding onto power at this point may rest in a scorched-earth campaign to disqualify as many votes as possible for his Democratic opponent, Joe Biden.

If there is a clear-cut outcome on Tuesday night that could not plausibly be challenged via legal action, all of the planning on both sides could become moot. But if there is no decisive result, the following days would likely see an intensifying multifront battle fought in a variety of states.

After months of claiming that any election outcome other than a victory for him would have to have been "rigged," the president used his final days on the campaign trail to cast doubt on the very process of tabulating the count, suggesting without any evidence that any votes counted after Tuesday, no matter how legal, must be suspect.

Both sides expect Trump and his allies to try again to disqualify late-arriving ballots in the emerging center of the legal fight, Pennsylvania, after the state's high court rejected a previous attempt and the Supreme Court refused to hear an appeal.

The scale of the Republican effort is beyond any that longtime civil rights lawyers said they could recall, and they, along with lawyers for the Democrats, said they were ready to meet Trump's lawyers in court.

"This is the most blatant, open attempt at mass disenfranchisement of voters that I've ever witnessed," said Dale Ho, the director of the Voting Rights Project at the American Civil Liberties Union, which has litigated several major cases this year.

Tom Perez, chairman of the Democratic Party, said Democrats were keeping careful track of all ballots that were being rejected in key swing states, under a strategy to get as many as possible fixed and reinstated now and seeking to force the reinstatement of the rest in postelection litigation if the closeness of the Electoral College count requires it.

Democratic Party lawyers, buoyed by the ruling in Texas and hopeful that even ideologically conservative judges would deny the Republicans' more brazen moves, were also preparing to monitor polling locations to be on the lookout for premature closings, long lines and unruly, pro-Trump election observers.

Trump comes to the fight having shown a willingness to use the levers of power to further his personal political interests in ways few other presidents have.

A wild card for both sides is the posture the Justice Department will take in voting disputes under Attorney General William P. Barr. On Monday, the department announced it was sending civil rights division personnel to monitor voting at precincts across the country, including in key areas like Philadelphia, Miami, Detroit and Houston. That is standard operating procedure, but both sides were girding for possible breaks from protocol given Barr's own statements about potential for fraud, which have echoed Trump's.

The Republican efforts moved to an even more aggressive footing on Sunday, after Trump made clear his intention to challenge an unfavorable outcome through a focus in particular on the mail-in vote, which both sides expect will favor Biden.

"I think it's terrible that we can't know the results of an election the night of the election," Trump told reporters ahead of a rally on Sunday night in North Carolina before saying he intended to send in his lawyers.

On Monday night, in an extraordinary moment that encapsulated the tenor of his presidency, Trump wrote on Twitter that the Supreme Court's Pennsylvania decision would "allow rampant and unchecked cheating" and "undermine our entire systems of laws" and "induce violence in the streets," drawing a warning on the platform that it was misleading.

The president has no legal authority to stop the count on Tuesday night, and even in normal election years, states often take days or even weeks before completing their tallies and certifying the outcome.

"If a jurisdiction doesn't get done counting its ballots on election night because of the volume, broken machines or any other reason, there's zero grounds for stopping it under any state's laws," said Benjamin L. Ginsberg, one of the nation's leading elections lawyers, who served as counsel to multiple Republican presidential candidates. "You're just going to disenfranchise people for his sport?"

Many states require ballots to arrive by Election Day to be counted, but several of them have sought to allow to be counted ballots that are postmarked on or before Election Day but arrive within a set number of days afterward. (In Pennsylvania it is three.)

In an interview, Justin Riemer, chief counsel for the Republican National Committee, indicated that much of the legal wrangling in the days to come would be over such late-arriving ballots, and he disputed Democratic charges that Republicans were solely seeking to knock out valid Democratic votes.

"Our position is that all lawfully cast ballots should be counted," he said. "If the ballot doesn't meet the deadline, then I guess if one considers that to be a technicality, so be it, but those ballots shouldn't be counted."

He said the party's efforts this year were about ensuring the election was conducted by the letter of the law. "We are protecting the existing safeguards that are in place and making sure the law is enforced and ensuring in the process that everyone can have confidence in the results," he said.

Trump has spent the past few years appointing conservative judges, an effort that has affected the balance on several appellate panels that will be critical in swing-state voting fights while giving the Supreme Court a new, 6-3 conservative tilt.

And he has another wild card in Barr.

This summer, Barr made a string of exaggerated claims about the problems with mail-in voting and opened the door to sending in federal authorities to stop voter fraud threats.

Behind closed doors, the attorney general briefed Trump on incremental developments in minor voter fraud investigations. The president, the White House and his campaign then promoted the cases as evidence that mail-in voting was highly problematic.

In the past couple of weeks, however, Barr and the Justice Department have gone quiet, leading to a new pressure campaign from conservative groups to aid Trump's efforts to stop the counting of any mail-in ballots that arrive after Election Day.

"DOJ should be prepared to go to court on this — it's Election Day, not election week or month," said Tom Fitton, head of the conservative group Judicial Watch.

Fitton, who said his group had more lawyers and investigators dedicated to scrutinizing this election than any other, said that Barr needed to be prepared to use his legal power — including the FBI — to ensure that states were keeping ballots that came in before Election Day separate from those that came in after.

Both sides agreed that some of the most important postelection legal wrangling would most likely take place in Pennsylvania, where uncertainty surrounds the state's plan to count ballots that are postmarked by Election Day but arrive in the three following days. The U.S. Supreme Court last week allowed Pennsylvania to keep that plan intact, although some of the justices opened the door to considering the issue again if necessary, and Republicans have indicated they might go back to the court.

That situation has led Josh Shapiro, Pennsylvania's attorney general and a Democrat, to issue guidance that election officials should segregate any ballots that arrive after 8 p.m. Tuesday.

"We made a careful decision to segregate those ballots in part to stave off possible future legal challenges from Donald Trump and his enablers," Shapiro said.

Some lawyers also believe there is the potential that unclear postmarks will be to 2020 what "dimpled chads" were to the 2000 recount in Florida. (The term denoted unclear preferences on the state's punch-card ballots.)

"I see that being the main area where there could be some disputes between the two sides," said Riemer, the Republican Party lawyer. "There is some ambiguity particularly in Pennsylvania in regard to how you treat a ballot that arrives after Election Day but does not have an indication that it is postmarked by Election Day."

Shapiro said his team had been preparing for different levels of challenges from Trump-aligned lawyers and groups.

"They'll be fanned out across Pennsylvania, on Election Day, and prepared for whatever challenges to possibly come beginning at 8:01 when the polls close," he said.

The Trump campaign and Republicans have also been seeking greater access to the election boards counting ballots, as they did in Clark County, Nevada, in a lawsuit that would have slowed counting there. Democrats equated that suit with harassment.

On Monday, a Nevada judge, James E. Wilson Jr., sided with the Democrats.

"There is no evidence that any vote that should be lawfully be counted has or will not be counted," Wilson wrote. "There is no evidence that any vote that should lawfully not be counted has been or will be counted."

With hours to go before Election Day, Republicans said they were considering an appeal.