Thomas Farr is sworn in during a 2017 Senate Judiciary Committee hearing on his nomination to be a District Judge on the United States District Court for the Eastern District of North Carolina. (Alex Brandon/AP)

President Trump’s nominee to be a federal judge in North Carolina cleared a key hurdle Wednesday when the Senate voted narrowly to advance him toward confirmation amid a racially charged controversy over his record as a lawyer.

But it was unclear whether Thomas Farr would have the necessary support to win confirmation. Sen. Tim Scott of South Carolina, the chamber’s only African American Republican, would not commit to supporting him, even as he voted to move the nomination forward.

Vice President Pence cast a tie-breaking vote to help Senate Republicans move Farr, who defended voting laws that a court ruled were designed to disenfranchise minority voters, to a final roll call expected later this week. The vote was 51 to 50.

After a nearly hour-long wait Wednesday, Scott cast a procedural vote to move ahead with Farr’s nomination, dashing Democratic hopes that he would join them to defeat it. Scott did not reveal his intentions publicly until he cast his vote Wednesday afternoon.

All 49 members of the Democratic Caucus opposed the nomination, as did Sen. Jeff Flake (R-Ariz.), who is opposing all judicial nominees until he gets a vote on legislation to protect the probe into Russian election interference by special counsel Robert S. Mueller III. All of the other Republican senators voted for Farr.

The tense vote came at a moment when racial tensions have risen to the forefront of the national political debate. Republican Sen. Cindy Hyde-Smith (R-Miss.) won a runoff Tuesday after a contentious campaign in which her comments about being willing to join a supporter in the front row of a public hanging stoked controversy. Her critics said the remark evoked Mississippi’s long history of lynching African Americans.

After the tally, Scott did not indicate how he would vote on final confirmation. He said he spoke with the author of a 1991 Justice Department memo obtained by The Washington Post that sheds some light on the 1990 campaign of Sen. Jesse Helms (R-N.C.), on which Farr worked.

The campaign received scrutiny for distributing postcards that the Justice Department later said were sent to intimidate black voters from heading to the polls. Scott said he had to speak to the author again “and continue to look at what role [Farr] did play at every facet of the process.” Scott said he has spoken to Farr.

Farr has denied playing any role in drafting the postcards.

The Senate Judiciary Committee advanced Farr’s confirmation with a party-line vote in January.

Trump nominated Farr to a seat on the U.S. District Court for the Eastern District of North Carolina that has been vacant longer than any other current opening across the country. President Barack Obama’s nominees — both African American women — did not receive hearings in the Senate.

Before his nomination, Republicans in control of the North Carolina General Assembly had hired Farr and others in his law firm to defend congressional boundaries approved in 2011. In 2016, a federal court struck down the map as racial gerrymandering.

Farr also helped defend a 2013 voter ID law that was considered one of the strictest in the nation. In addition to requiring residents to show identification before they could cast a ballot, the law also eliminated same-day voter registration, got rid of seven days of early voting and ended out-of-precinct voting.

A federal court ruled in 2016 that the primary purpose of North Carolina’s law wasn’t to stop voter fraud but rather to disenfranchise minority voters. The judges wrote that the law targeted African Americans “with almost surgical precision,” in part because the only acceptable forms of voter identification were ones disproportionately used by white people.

In addition to opposition from Senate Democrats, Farr’s nomination drew public rebukes from Andrew Gillum and Stacey Abrams, high-profile African American gubernatorial nominees in Florida and Georgia who lost close races in the midterms.

“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 said Tuesday in a joint statement.

Seung Min Kim and John Wagner contributed to this report.