WASHINGTON — A controversial judicial nominee narrowly made it through a key procedural vote in the Senate on Wednesday following a dramatic extended voting period that resulted in Sen. Tim Scott, R-S.C., delivering the final affirmative vote to advance the nomination.

Thomas Farr, President Donald Trump's nominee to be a U.S. District Court judge for the Eastern District of North Carolina, has come under fire because because of his past work defending state laws that Democrats say have disenfranchised African-Americans from voting.

All Democrats opposed Farr's nomination as well as Sen. Jeff Flake, R-Ariz., who is voting against all judicial nominees until GOP leaders agree to hold a vote on his bill to put up guardrails against any threat of Trump firing special counsel Robert Mueller.

But it was Scott who delivered the deciding vote. The procedural vote was held open for 45 minutes as Scott sat in the cloakroom off the Senate floor "doing homework" on the nominee, according to a Scott aid.

Scott has wrestled with his decision on the nomination, telling reporters that he remained undecided. And his support of Farr in the procedural vote might not be his final say on the nominee. The Senate will have a final vote to confirm Farr as early as Thursday.

Asked how he might side on the final vote, Scott said, "I don't know yet."

The vote tally on the procedural measure was 51-50, with Vice President Mike Pence breaking the tie.

Thomas Farr is an employment lawyer at Ogletree and Deakins in Raleigh, where he has been the lead counsel defending clients against racial discrimination and workplace violation complaints.

Democrats say that he was instrumental in keeping minorities from voting, including working to defend North Carolina’s restrictive voter identification law. They also point to his legal work on the campaign of former Sen. Jesse Helms, R-N.C., who was investigated for intimidating black voters in 1990.

"Mr. Farr was chief cook and bottle washer for the state that probably did more to prevent people, particularly African-Americans, from voting than any other state," Senate Democratic Leader Chuck Schumer said. "This is despicable. Absolutely despicable."

Scott has helped defeat a Trump judicial nominee in the past for racially insensitive writings, raising objections about Ryan Bounds, a nominee for the ninth circuit. Sen. Marco Rubio, R-Fla., sided with Scott and came out in opposition to Bounds, resulting in the nomination being pulled just moments before the final vote was set to take place.

Rubio’s spokeswoman, Olivia Perez-Cubas, said the senator would support Farr in this vote. "The Senator sees no reason not to support his nomination, so he’ll be a yes," she said.

The NAACP and the Congressional Black Caucus oppose the nomination and held a protest outside a Senate hearing room last January when the committee advanced his nomination on a party-line vote.

Two African-American candidates who lost their bids for governor this month, Stacey Abrams of Georgia and Andrew Gillum of Florida, released a joint statement of opposition to Farr on Tuesday. “When it comes to the trifecta of voter disenfranchisement — voter suppression, racial gerrymandering, and restriction of voting rights — Thomas Farr is, sadly, one of the most experienced election lawyers in the country," they wrote.

Sen. James Lankford, R-Okla., said he will support Farr’s nomination after reviewing his work "a lot."

"This is an attorney doing his job working for different clients," Lankford said.

Sen. Susan Collins, R-Maine, a moderate who sometimes bucks her party, said she’d support him, too, citing his rating of "well qualified" with the American Bar Association.