RICHMOND, Va. — Nine months ago, Democrats at every stratum in Virginia called on Gov. Ralph Northam to resign over a racist photograph on his medical school yearbook page.
Mr. Northam bumbled his response, admitting he was in the picture before saying he was not, then seemed like he might demonstrate Michael Jackson’s moonwalk at a news conference where he acknowledged blackening his face for a dance contest.
Now, after Democrats won control of the Legislature on Tuesday, Mr. Northam is positioned to be the most consequential Democratic governor in America in 2020, aiming to enact strong gun restrictions and L.G.B.T.Q. protections and clear the way to take down Confederate statues — all potential headline-making changes that could galvanize the party base nationally in the presidential race.
For Mr. Northam, a medical doctor with a rural drawl, and a political moderate whom Republicans once hoped to recruit, it is an astonishing reversal of fortune. His salvaging of a year that began in disaster is a testament to a political age in which the half-life of scandal is brief and where suburban voters are punishing Republicans because of President Trump. It also reflects Mr. Northam’s own efforts, largely out of the headlines, in repairing the damage with black constituents and lawmakers.
Virginians “supported me through this,” Mr. Northam said in an interview. “And they supported what our agenda has been on Tuesday, and now we need to deliver.”
Nudged to reflect on his personal arc of the past nine months, the governor deflected, steering attention instead to achievements in his two years in office: Medicaid expansion, criminal justice reform and luring an Amazon headquarters to Northern Virginia. “My drive is to serve Virginia. That’s been my life, one of service,” he said earnestly.
The scandalous events of February that drew intense media attention played no apparent role in dampening enthusiasm for Democratic candidates on Election Day, as the party once feared.
“I kind of forgot about the blackface until you brought it up just now,” Tanisha Kelly, an adviser at a group home in the Richmond suburbs, said last week after voting for Democratic state lawmakers. She said the governor had seemed invisible during the campaign, making little impression on her.
Most governors love the limelight during an election season, but Mr. Northam may have helped himself this year by quietly tending to alliances and candidates and largely letting events play out rather than be seen as trying to stage manage them. And by all appearances he seemed fine letting other politicians cut a bigger figure on the campaign trail.
Mr. Northam did appear at get-out-the-vote rallies in the final weeks before Election Day, and at two dozen political events over the summer. But his predecessor, Terry McAuliffe, who in the spring ended a flirtation with a presidential run, was far more visible on the campaign trail. Mr. McAuliffe’s boisterous glad-handing was the opposite of Mr. Northam’s measured reserve. The former governor popped up at more than 125 parades and political events for candidates, sparking rumors that he might run again for governor in 2021. (Mr. Northam will be ineligible because Virginia governors cannot serve back-to-back terms.)
While Mr. Northam’s political action committee raised $1.5 million for Democrats on the ballot, it was a more modest sum than the $7.1 million that Mr. McAuliffe raked in for legislative races four years ago.
“What brought people to the polls on Tuesday, it was vote for Governor Northam’s agenda,’’ said Jennifer Carroll Foy, a member of the House of Delegates. “I believe that no one wants to get in the way of what he can do here in Virginia.’’
In the end, money was no problem: It rained down on Democrats from national anti-gun and abortion rights groups, and from individual donors in the state and around the country. All were driven to flip the General Assembly, where Republicans’ narrow majorities were the last barrier to unified Democratic control of state government for the first time in 26 years.
Party officials and analysts in Virginia said Mr. Northam owed his political survival to fortuitous events as well as his own efforts.
Just days after the surfacing of Mr. Northam’s 1984 yearbook photo — with one figure in blackface and another in Ku Klux Klan robes — the lieutenant governor, Justin Fairfax, was accused of sexual abuse by two women, which he denied. Before the week was out, Attorney General Mark R. Herring acknowledged he had worn blackface as a college student.
With the state’s top three Democrats compromised, the desire to force them from office and make way for the Republican next in line lost appeal to many in the party.
Republican candidates who reminded voters of Mr. Northam’s past had little success in the fall. Glen Sturtevant, a state senator in difficult terrain in the Richmond suburbs, ran TV ads flashing the yearbook picture and accusing his opponent, Ghazala Hashmi, of once calling on Mr. Northam to resign, until he donated $25,000 to her, “buying her silence.”
Despite the attack, Ms. Hashmi crushed Mr. Sturtevant in Richmond precincts with many black voters, the key to her upset victory.
“The liberal groups that should have continued to put pressure on Governor Northam for this scandal made the political calculation that it was better for their self-interest to shut up about it,” said Will Ritter, a Republican strategist in the state.
Whatever doubts that lingered with Democratic voters about state leadership were largely banished in the summer, when the governor called the Legislature back to Richmond to pass gun restrictions after a mass shooting in Virginia Beach on May 31.
The Republican majorities adjourned the session after 90 minutes, a bit of political drama that stuck with many voters in November.
“The calling of the special session turned out to be brilliant,” said Bob Holsworth, a longtime political analyst in the state. “Republicans couldn’t bring themselves to go against their rural base to make changes. This put a totally different dynamic on the election.”
Mr. Northam said the eight bills he introduced in the aborted session would be the first ones out of the gate when the new General Assembly majorities meet in January. They include universal background checks, a ban on assault rifles and high-capacity magazines, limiting handgun purchases to one a month and a so-called red flag law to let a court remove weapons from people who pose a threat. He has not ruled out confiscating assault weapons from gun owners.
Mr. Northam, who has treated gunshot victims as a pediatric neurologist and an Army medical officer, said he had hoped for bipartisanship from Republicans when he called a special session. “I said I want to dialogue. I want votes and laws,” he said. “They had an opportunity to have that dialogue and they chose not to, and I think they paid that price on Tuesday.”
All year, Mr. Northam has retained the support of black voters. Even as his overall approval plunged to 40 percent two months after the yearbook photo surfaced, 63 percent of African-American voters wanted him to remain in office, according to a poll by Christopher Newport University in Newport News, Va.
The same pollster found in an October survey that Mr. Northam’s overall approval had recovered, to 51 percent.
Defying calls to resign by the Democratic caucuses in the House of Delegates and State Senate in February, the governor vowed to dedicate the rest of his term to fighting racial inequity. His effort won support from black lawmakers.
He created a commission to comb Virginia’s laws for legacies of Jim Crow, and a second commission to review school textbooks for fair coverage of black history. He pushed for a provision to restore drivers’ licenses to people who have had them suspended for failure to pay fines.
Last week, the governor included two historically black colleges in $1 billion of funding to graduate more computer science majors from the state’s universities.
Lamont Bagby, a member of the state’s House of Delegates and chairman of the Legislative Black Caucus, said two-thirds of caucus members were graduates of H.B.C.U.s, and ensuring more state support was a priority.
“February put the issues that have been important to the black caucus for decades on the front burner,” Mr. Bagby said, expressing his support for Mr. Northam. (Back in February, the Legislative Black Caucus had called on the governor to resign.)
Looking ahead, Mr. Bagby said black lawmakers want to see laws aimed at preventing evictions and increasing affordable housing. He added: “There is no reason why we can’t finally have a discussion on monuments.”
Mr. Northam said he supports overturning a century-old law that would clear the way to let local governments decide the fate of Civil War statues.
Modesty is not a quality in demand in modern American politics, either from voters or officeholders. But Mr. Northam’s level of self-effacement may have been what helped him survive. “The election on Tuesday was about Virginia,” he said. In other words, not Ralph Northam.