Correction: An earlier version of the article misstated the number of seats held by Republicans in the state House of Delegates. Republicans hold 65, not 78, of the House’s 100 seats. Democrats hold 32 seats, and an independent holds one. Two seats are vacant. This version has been corrected.

The two major-party candidates for Virginia Attorney General, Democrat Mark Herring, left, and Republican Mark Obenshain, participate in a campaign debate hosted by the Loudoun County Chamber of Commerce at the National Conference Center on Oct. 2. (Jahi Chikwendiu/The Washington Post)

An extraordinarily tight race for Virginia attorney general appears to be the only obstacle to the first Democratic sweep of all three statewide offices in 24 years, according to a new Washington Post/Abt SRBI poll Monday.

Republican Mark D. Obenshain and Democrat Mark R. Herring are in a near dead heat to become Virginia’s top lawyer. Herring, a state senator from Loudoun County, has the support of 49 percent of respondents, while Obenshain, a senator from Harrisonburg, gets 46 percent. The race is within the poll’s margin of error.

The Democrats running for governor and lieutenant governor have substantial leads over their GOP opponents. Terry McAuliffe leads Attorney General Ken Cuccinelli II by 12 percentage points for the top job. State Sen. Ralph S. Northam (D-Norfolk) leads minister E.W. Jackson by an identical margin in the race for lieutenant governor, the poll shows.

If the leads hold, Democrats would occupy all three statewide seats for the first time since 1989. If the two U.S. Senate seats are included, Democrats would hold all five offices for the first time since 1970.

Obenshain is more competitive than his fellow Republican candidates because he appeals more to political independents, according to the poll. Obenshain outperforms Herring among this group by a narrow 48 to 42 percent margin, while Cuccinelli and Jackson each lose independent likely voters by double digits, the poll shows.

Republicans, meanwhile, are likely to continue their dominance the House of Delegates, where all 100 seats are up for election next week. The GOP holds 65 of those seats.

Both major parties agree that 12 House seats are competitive, mostly in Northern Virginia. Democrats could see a modest gain as crucial leverage in committee appointments and being able to sustain a gubernatorial veto.

Those dynamics have recently led to large infusions of cash in lower races by both parties.

Last week, the Republican State Leadership Committee gave $660,000 to Obenshein’s campaign, while other party groups have poured money into close House races in Fairfax and Loudoun counties.

Meanwhile, the Democratic Attorneys General Association of Virginia has given Herring $680,000, according to the Virginia Public Access Project, a nonpartisan, nonprofit group that monitors political money.

The Post poll found that the competition for the attorney general’s office and for House seats is being affected by recent events.

Among likely voters, 69 percent of those surveyed considered the recent partial shutdown of the federal government an important factor in their vote, the poll found. In addition, more than half of those polled said the ethics scandal involving Republican Gov. Robert F. McDonnell is an important factor, the poll found.

In the attorney general’s race, another factor may be the publicity surrounding the conservative stances of both Cuccinelli and Jackson at the top of the GOP ticket.

Both men have pushed the state Republican Party further to the right, with Jackson, a conservative Christian minister, drawing headlines with controversial remarks about gays, women and others.

Among other statements, Jackson has said that gay people’s minds are perverted and that non-Christians are “engaged in some sort of false religion.”

Obenshain has pushed mostly noncontroversial issues, such as promoting ethics reform and cracking down on sex offenders, human traffickers and abusers of the elderly.

His position and style have won him support from some moderate Republicans who crossed party lines to endorse McAuliffe in the gubernatorial race.

But Obenshain, like the other GOP candidates, faces a daunting hurdle, the poll found.

Among those surveyed, 57 percent say they have a negative view of the state Republican Party, compared with the 48 percent who expressed a negative view of the party in May.

Democrats improved slightly in that category, with 45 percent expressing a negative view, compared with 47 percent in May.

Leah Binkovitz, Scott Clement and Victoria St. Martin contributed to this report.