State officials scrambled Wednesday to uphold the Electoral College process as a Harvard Law School professor insisted that he was closing in on enough Republican defectors to upend President-elect Donald Trump.

Professor Lawrence Lessig said his group, Electors Trust, and two other organizations advising electors behind the scenes have found 20 to 30 Republicans who are considering withholding their votes for Mr. Trump at the Monday ceremony.

An exodus of 37 electors would put Mr. Trump at 269 electoral votes, one shy of the 270 needed to make his win official, and throw the decision to the Republican-controlled House.

“Our goal is to let the electors exercise their judgment, and what we believe is at least 37 electors will make the judgment not to support Donald Trump” Mr. Lessig told MSNBC. “And if that happens, then of course it goes to the House, and the House has to pick among the top three candidates.”

The current number may be higher than 20. “Some tell me that the number is higher than that. It should be more like 30, but I feel confident saying there’s at least 20,” said Mr. Lessig, who was briefly a candidate for the Democratic presidential nomination.

National Republicans aren’t buying his claim, but the revelation that Democratic lawyers are providing legal advice to Republican electors has fueled the turmoil surrounding this year’s Electoral College vote.

At least three states — California, Colorado and Washington — have grappled with lawsuits filed by electors seeking to deviate from the popular vote.

In Washington, a federal judge rejected Wednesday a bid by two “faithless electors” — in this case, two electors who would be expected to support Hillary Clinton — for an injunction that would allow them to vote their conscience.

Washington state’s secretary of state spokesman Dave Ammons said any Democratic electors in Washington who bolt from Mrs. Clinton will face the possibility of civil penalties, which would be a first since the law binding electors to the popular vote was passed in 1977.

Another group of more than 50 electors — again, mostly Democrats — led by House Minority Leader Nancy Pelosi’s daughter Christine, a California elector, have signed a letter demanding an intelligence briefing on allegations of Russian interference in the campaign.

Only one member of the Pelosi group, Chris Suprun of Texas, is a Republican.As a result, it doesn’t matter how the Democrats vote Monday as long as at least 270 Republican electors stand by Mr. Trump.

Left-wing filmmaker Michael Moore issued a plea for Republican electors to “have a stand-up moment and say, ‘I care about this country.’”

“Hopefully, there is a chapter to be added to John F. Kennedy’s ‘Profiles in Courage’ on Monday,” Mr. Moore said on MSNBC. “We only need 37 more of these electors, and they have to be Republican electors.

In Colorado, Secretary of State Wayne Williams wants to stop the electors before they become faithless. After a judge ruled Tuesday that such electors may be replaced, he began working with the state Democratic Party to line up substitutes.

If any of the nine Democratic electors either declines to take the pledge swearing to follow the popular vote or support Mrs. Clinton, Mr. Williams said, they will “cease to be an elector under the provisions of Colorado law” and will be immediately decertified.

Substitutes provided by the state Democratic Party are scheduled to be on site during the ceremony at the state capitol, he said.

The Democrats are aligned with the Hamilton Electors movement, which seeks to persuade a total of 270 Democratic and Republican electors to join forces and support a consensus candidate in order to keep Mr. Trump out of the White House.

A federal judge ruled Monday against two Colorado Democratic electors who had sought an injunction against the state law binding them to the winner of the popular vote.

Mr. Williams, a Republican, said the 1959 state law, not politics, is driving his decision.

“It is the requirement of Colorado law that electors vote as Colorado voted, and as secretary of state, I would enforce that law regardless of who won the election,” Mr. Williams said. “And in fact in this case, it may be one of the first times in my life that I’ve asked people to vote for a Democrat. But that’s what Colorado law provides. And we’re a nation of laws.”

Finding a consensus candidate that 270 Democratic and Republican electors would back is tougher than flipping 37 Republicans, as Electors Trust is trying to do.

Mr. Lessig warned that the 20 or so Republicans contemplating a break with the party may not do so come Monday if they see the effort as fruitless.

“Now, of course, if they don’t get to 37, I doubt any of them beyond the one Chris Suprun, who’s actually come out in public, is going to vote against Donald Trump,” Mr. Lessig said. “But if the number gets to 40, or around 40, then I think you’re going to see a very interesting dynamic as they see that there’s a reason to exercise their vote of conscience, which I think they’re all struggling with right now.”

What if the House Republican majority picks Mr. Trump? “That’s the constitutional rule,” Mr. Lessig said. “The House gets to decide. All we’re defending is the constitutional right of these agents to exercise their judgment.”

Officials with the Republican National Committee have dismissed concerns about such a scenario. They said their whip operation has detected only one at-risk elector, Mr. Suprun, according to Politico.

Still, opponents of Mr. Trump are determined to fight until the last Electoral College ballot is cast. Left-wing groups such as Progressive Change Campaign Committee, Americans Take Action and Democracy Spring are organizing protests at the 50 state capitols to coincide with the electoral vote.

Twenty-nine states and the District of Columbia bind their electors to the popular vote, but Mr. Lessig said Mr. Trump’s victory gives them a “moral reason” to deviate from the will of the voters.

“[T]hey have a moral or ethical obligation once they take the pledge, and they must vote that way unless there’s a moral reason not to vote that way, and the disqualification or failure of a candidate not to live up to the qualifications would be one such reason, and that’s exactly the issue that’s raised by this election,” Mr. Lessig said. “The Electoral College was made for this election precisely.”