Virginia Gov. Terry McAuliffe (D) hailed passage of the ethics measure in the Republican-controlled General Assembly as a “victory for transparency and accountability.” (Sarah L. Voisin/The Washington Post)

Virginia legislators, meeting in overtime Friday in a capitol struggling to clean up its image, bowed to Gov. Terry McAuliffe’s call to shrink the value of gifts they can accept from lobbyists.

Lawmakers, who until recently were free to accept personal gifts of unlimited value from people with business before the government, voted to limit what any individual can give to $100 a year.

But the Republican-controlled General Assembly also bucked McAuliffe (D) on more than two dozen other amendments he had proposed for the bill, saying they were unworkable or too burdensome.

Once amended, the measure passed both chambers unanimously. The votes came after legislators pulled off a series of unusual parliamentary gymnastics to enable them to fix a drafting error in McAuliffe’s most prominent amendment. Seeking to close a loophole that could have allowed legislators to accept an unlimited succession of $100 gifts, the governor had inadvertently recommended a $100 lifetime limit rather than an annual one.

That amendment was just one of 49 that McAuliffe had made to the ethics bill, the legislature’s second attempt in as many years to tighten rules in the wake of a $177,000 gifts scandal involving former governor Robert F. McDonnell (R) and his wife, Maureen.

Legislators rejected over half of the changes that the governor had sought, saying in many cases that McAuliffe’s amendments had unintended consequences that would be a burden for local officials also covered by the law.

One of those rejected could have required local officials traveling on official business to report the use of a county car as a personal gift.

They also shot down an amendment that would have required local registrars and electoral board members to make annual financial disclosures. Supporters said the change would reveal whether officials empowered to buy voting machines are being wined and dined by sellers. But opponents said that burden would make it nearly impossible to find people to serve on electoral boards, which are hard to fill.

After the vote, McAuliffe stressed that the legislature had embraced his main goal on the $100 limit and said he would sign the bill.

“I am pleased that the General Assembly has accepted my top ethics reform priority: a $100 annual aggregate cap on gifts that public officials can receive from people seeking influence with the state,” McAuliffe said in a written statement. “This victory for transparency and accountability will strengthen the legislation passed this year significantly. It will also send Virginians a message that their leaders recognize the need to restore their trust in government.”

Legislators in both chambers and on both sides of the aisle praised the latest gift law as another step forward for Virginia. The McDonnell saga aside, the state had a proud history of clean government even when it operated under some of the loosest ethics laws in the nation.

In the state Capitol, where Thomas Jefferson is regularly invoked, House Minority Leader David J. Toscano (D-Charlottesville) leaned on the wisdom of Jerry Garcia to sum up Virginia’s two-year-old ethics drama.

“What a long, strange trip it’s been,” Toscano said.

And the trip might not be over.

Even Senate Majority Leader Thomas K. Norment Jr. (R-James City), who complained earlier this year that the news media was driving the ethics debate, predicted there would be more to come.

“I expect it’s going to continue to evolve over future legislative years, and that’s okay,” he said. “I know there are some segments of society that we will not please because it has not gone far enough.”

McAuliffe made amendments to 50 of the 800 bills the General Assembly passed this year and vetoed 17. In the ethics bill alone, he made 49 separate amendments.

The General Assembly had hoped to consider all of his recommendations when it gathered Wednesday for what was supposed to have been a one-day “veto session.” But the ethics bill got bogged down because of an error in one of McAuliffe’s amendments.

The bill that the General Assembly originally sent McAuliffe had a $100 per-gift limit, meaning a lobbyist could give a legislator an unlimited succession of $100 gifts without running afoul of the law.

Supporters of that version had said they were concerned about the “housekeeping” burden of having to keep track of every T-shirt, coffee mug or dinner that a civic group might provide — and feared they would exceed the limit without realizing it.

But McAuliffe saw it as a loophole intended to keep the gifts flowing. Amid a backlash, legislative leaders quickly got on board with an aggregate limit.

Fixing the glitch in that amendment required a complicated series of steps, ones the General Assembly was not prepared to launch after wrapping up business on the other bills after 9 p.m. Wednesday.

So the legislators extended the veto session until Friday, to the chagrin of those from some of the farthest corners of Virginia. For Sen. Charles W. Carrico Sr. (R-Grayson), that meant making the 10-hour round trip between his Southwest Virginia home and Richmond twice this week instead of once. Unable to stay in Richmond because he had a doctor’s appointment at home Thursday, he wished the legislature had operated at a faster clip.

“I’ve lived my life making quick decisions,” said Carrico, a former state trooper. “Everybody else in here is used to long, drawn-out conversations.”