An attorney for state Sen. Mark D. Obenshain hinted in court Monday that the Republican would consider using an obscure law to throw the outcome of the attorney general’s race into the hands of the General Assembly.

The lawyer made the statement as legal teams for Obenshain and Democrat Mark R. Herring jockeyed for advantage in advance of next week’s statewide recount.

Even floating the idea of contesting the race through the legislature is an act of political daring. Until now, Republican leaders, including Gov. Robert F. McDonnell (R), have indicated that they thought a challenge would be inappropriate unless evidence of major voting irregularities emerged.

Obenshain, of Harrisonburg, lost the race in November in the closest statewide election in Virginia history, with Herring, a senator from Loudoun County, besting him by just 165 votes out of 2.2 million cast. Those results are the subject of a recount to be conducted next week.

But the fight to become the state’s top law enforcement officer, a position often used as steppingstone to the governor’s mansion, might not end there. As he argued for access to certain voting records Monday, Obenshain attorney William H. Hurd said the campaign would need time to review them before the Dec. 23 deadline to contest the election with the General Assembly.

“Depending on what we see, we may wish to consider that possibility,” he said, noting that the Herring campaign might want to do the same if it were to lose the recount.

Hurd’s comments were the first indication by the campaign that it might invoke a little-known state law that allows the losing candidate in a recount to contest the result with the legislature. This year, such a move would leave the ultimate outcome of the race in the hands of a joint session of the GOP-dominated House and evenly split Senate.

Hurd also floated new questions about how ballots were handled in Fairfax County and raised the specter that ballots in the state’s largest jurisdiction would be vulnerable later this week. He said a power outage scheduled to accommodate repair work would disable the electronic locks on the safe holding Fairfax ballots.

Herring attorney Kevin J. Hamilton dismissed the issues Hurd raised as “just an effort to distract more than anything.”

Both attorneys appeared in Richmond Circuit Court before a three-judge panel overseeing the recount, waging a four-hour battle over seemingly arcane but potentially consequential rules for how the recount will be carried out. Obenshain’s team persuaded the judges to grant it the right to receive previously sealed election records, including access to electronic data from the poll books used to check in voters.

The judges — Richmond Circuit Court Judge Beverly W. Snukals, Norfolk Circuit Court Judge Junius P. Fulton III and Danville Circuit Court Judge Joseph W. Milam Jr. — also ruled that observers for each campaign will not be allowed to directly ask questions of officials re-counting the ballots or otherwise interrupt the proceedings, though they will be allowed to direct inquiries to a recount coordinator.

Fairfax will begin its recount Dec. 16, and most of the rest of the state will start the next day. The judges decided to give two other jurisdictions, Alexandria City and Chesapeake City, the same head start as Fairfax because they expect to have to count many ballots by hand. The recount court hopes to declare a winner by the end of that week.

Hurd raised new questions about how the election was handled in Fairfax County, which was previously the subject of Republican complaints because of shifting poll numbers and the fact that some voters who cast provisional ballots in the heavily Democratic county were given more time than voters in other parts of the state to prove that their ballots should be counted. Fairfax officials alerted both campaigns over the weekend that all ballots were not transferred from polling places to the circuit court clerk’s office the day after the Nov. 5 election as required by law, with some arriving as late as Dec. 5. Obenshain’s attorneys asked the panel to set aside those votes; the judges declined to do so, instead encouraging Hurd to get more information from Fairfax and to come back if he still thought there was a problem.

Brian W. Schoeneman, secretary of the Fairfax Electoral Board, said that elections officials at two precincts accidentally locked ballots in a large cart for voting machines and other Election Day supplies instead of sending the ballots to the courthouse. He said the ballots were always secure, locked in the carts, which were then locked inside a warehouse until they were discovered and sent to the courthouse.