RICHMOND — Virginia lawmakers wrapped up the strangest General Assembly session in anyone’s memory Sunday, plowing through blackface scandals and sexual assault allegations to reach a bipartisan deal on taxes and position all 140 legislators for fall elections that could determine partisan control for years to come.

The chaos overshadowed actual legislative accomplishments, including bipartisan agreement on incentives for the massive Amazon headquarters project in Arlington County, a plan to clean up coal ash ponds around the state, a law raising the legal age to buy tobacco products to 21 from 18 and pay raises for teachers and other public employees.

The drama continued through the final moments of the session — extended by one day in an act of political payback — as Lt. Gov. Justin Fairfax (D) vigorously defended himself against sexual assault allegations from the Senate dais.

“If we go backwards and we rush to judgment, and we allow for political lynchings without any due process, any facts, any evidence being heard, then I think we do a disservice to this very body in which we all serve,” Fairfax said in response to Senate Majority Leader Thomas K. Norment (R-James City), who had briefly praised Fairfax’s ability to keep presiding over the body amid the frenzy.

Senators reacted to Fairfax’s extended remarks with silence.

“Probably the most infamous session since 1861” is how Sen. Chap Petersen (D-Fairfax) summed it up.

Efforts to pass the Equal Rights Amendment and extend discrimination protections to gay men and lesbians, which initially seemed to have broad support, foundered in a climate of degenerating politics and historical irony.

Revelations that the Democratic governor and attorney general both wore blackface as young men sparked wrenching discussions about race as Virginia marks the 400th anniversary of the first Africans arriving in the British colony in 1619.

Gov. Ralph Northam defied calls to resign. Attorney General Mark R. Herring hunkered down outside of public view for nearly a month. And the session ended with partisan discord over how to handle a pair of sexual assault allegations against Fairfax, only the second African American elected statewide in Virginia’s history.

The scandals fed a national sense that the state’s leadership was a shambles just as Virginia observed another big anniversary: 400 years of representative democracy stretching back to Jamestown.

“It had more drama than we could possibly have imagined or would want to deal with,” Sen. Barbara A. Favola (D-Arlington) said. Nevertheless, she said, “We got a lot done. The lawmakers kept their noses to the grindstone and the state ran.”

In a snub, the House and Senate did not send a delegation of lawmakers to the governor’s ceremonial office in the Capitol to report that they had adjourned, as is customary. Northam had let them know earlier Sunday that “he would be ready to receive them,” spokeswoman Ofirah Yheskel said. Northam got a half-hour’s notice that they would not be coming.

Attention on campaigns

Now that the 46-day General Assembly session is over, attention will shift toward November elections.

Just 15 minutes after gaveling out, House Republicans launched a YouTube ad that spliced national coverage of the Democratic scandals with local TV reports on Republican plans for school safety, tax cuts and autism.

“Virginia’s choice is clear: chaos and embarrassment,” a female narrator says, “or leadership and results.”

House Democrats were not far behind with a fundraising pitch pegged to bills blocked by the GOP, including efforts to raise the minimum wage, pass the ERA, tighten gun laws and ban discrimination against the LGBT community.

Republicans hold two-seat majorities in both the House of Delegates and the state Senate, and Democrats had been hoping that momentum was on their side to take back control for the first time in a generation. Part of the prize: the ability to control statewide redistricting in 2021.

That dynamic heightened political tensions during the session. Democrats made a show of pushing legislation to limit access to guns, raise the minimum wage and restrict the use of fossil fuels — knowing that Republican leadership would shoot it all down, but planning to campaign on it this fall.

Republicans were happy to oblige, building toward a message that a Democratic majority would lead to laws that are out of step with middle-of-the-road Virginians and unfriendly to business.

As part of that strategy, Republicans highlighted a bill sponsored by Del. Kathy Tran (D-Fairfax) aimed at loosening restrictions on late-term abortions in cases where the mother’s life or health was at risk. A video of Tran saying that her bill would allow abortion up to the moment a woman goes into labor went viral, and Northam’s poorly worded effort to defend the bill on the radio had national commentators saying he favored infanticide.

Amid the national outcry over the governor’s abortion comments, someone supplied a right-wing political website with a racist photo from Northam’s 1984 medical school yearbook page showing figures in blackface and Ku Klux Klan garb.

Cascading scandals

Northam first took responsibility for the photo, then disavowed it — but he admitted wearing blackface later that same year while dressed as Michael Jackson for a dance contest.

Virtually all state and national Democrats called on him to resign. Northam refused, saying he would seek racial reconciliation, and the pressure eased when the rest of the executive branch suffered cascading scandals.

First one woman came forward to say Fairfax sexually assaulted her in 2004 at the Democratic National Convention in Boston; then Herring, who had called for Northam’s resignation, admitted wearing blackface as a college student in 1980. Then a second woman accused Fairfax of sexually assaulting her in 2000 while they both were students at Duke University. Fairfax has denied both charges and called for law enforcement to investigate.

Republican House Speaker Kirk Cox (Colonial Heights), who would be next in line for the governorship if all three top executives resigned at once, has backed a plan to hold a public committee hearing to receive testimony from Fairfax and both women. One accuser accepted the invitation; the other said she is eager to testify but signaled discomfort with any process that isn’t bipartisan.

House Democrats called the plan overtly political and inappropriate until law enforcement has had a chance to investigate. Those partisan accusations on Friday — the eve of the legislature’s scheduled adjournment Saturday — put final budget negotiations under a cloud.

Most lawmakers were ready to get out of Richmond on Saturday, when final tweaks to the budget were unveiled at 11 a.m. But House Democrats insisted on observing a rule that the spending plan be public for 48 hours before a vote. It was payback for House Republicans, who days earlier had refused to waive other House rules to allow a floor vote on the ERA.

After a long standoff Saturday, legislators agreed to cut the public notice to 24 hours. And so they returned Sunday at 11 a.m.

Both chambers were in and out in an hour. They approved ­changes to the state’s existing two-year, $117 billion budget, including extra money for teachers as well as at-risk public school students and eviction prevention — two areas pushed by Northam as part of his effort to spend the rest of his term focused on solving racial inequities.

Some of the other topics this year’s General Assembly addressed included:

Redistricting: The legislature passed a resolution calling for a constitutional amendment to create an independent redistricting commission. The measure is just the first step. It will have to pass the legislature again next year and then win approval from voters in a referendum.

Minimum wage: Democrats’ bills to raise the state’s $7.25-an-hour minimum wage to $15 failed. So did measures intended to close a loophole in state law allowing employers to pay certain workers even less.

Economic development: The legislature approved state tax incentives of up to $750 million to Amazon, on the condition that the company creates tens of thousands of jobs with average pay of at least $150,000 a year. (Amazon founder and chief executive Jeffrey P. Bezos owns The Washington Post.)

Transportation: An ambitious, bipartisan plan to make $2.2 billion in fixes to Interstate 81, rolled out on the eve of the session by Northam and prominent Republicans, fell apart. Advocates, who originally called for tolls to finance the project, had to settle for legislation calling for a study of the highway.

Social issues: Legislation related to guns, abortion and gay rights were mostly at a standstill in the closely divided legislature. One exception: passage of a bill making it easier for gay couples to have children through surrogacy arrangements. And lawmakers reelected openly gay Judge Tracy Thorne-Begland, whose original election to the Richmond General District Court in 2012 created enormous controversy, to another six-year term without debate.

Correction: An earlier version of this article incorrectly reported that legislators had elevated Richmond General District Court Judge Tracy Thorne-Begland to Circuit Court. In fact, they reelected him to General District Court.