Voter registration in Virginia will resume immediately and continue until midnight Friday, a federal judge ordered Thursday.

Judge Claude M. Hilton of U.S. District Court in Alexandria decided to extend registration after the state elections website crashed on Monday, the last day for Virginians to get on the rolls.

A civil rights group sued on behalf of Kathy and Michael Kern, a Charlottesville couple who tried and failed multiple times Sunday and Monday to register. Two nonprofit groups involved in voter-registration drives — New Virginia Majority Education Fund and Virginia Civic Engagement Table — also were plaintiffs.

“Thousands, if not tens of thousands, of people” tried and failed to register, their attorney, John A. Freedman, said in court Thursday.

Virginia Gov. Terry McAuliffe (D) supported the lawsuit, saying residents should get more time to register.

“I am pleased that we are able to offer the individuals who were unable to register another opportunity to make their voices heard and we are working hard to ensure that this process, as well as the remainder of this election cycle, is smooth and easy for everyone who participates,” McAuliffe said in a written statement issued after the ruling.

The plaintiffs and the state government agreed that voting should be allowed until 11:59 p.m. Monday to account for both the two days of outages and any similar problems in the next few days, as well as the time it will take to notify voters of the extension.

But Hilton deemed that extension would be too lengthy.

“I think you’re entitled to some relief,” Hilton said, but added, “I believe that you’re asking for too much time.” An extension through Friday night, he said, “more than makes up for” the two days of major technical failures.

Assistant Attorney General Anna Birkenheier, representing state elections officials named as defendants, argued that four days would provide “a safety net” in the event of future crashes. She also said it would be impossible to contact the people who tried to register online and failed, because their information was never recorded by the online system.

“If the system crashes again, we’ll address that,” Hilton said. “I don’t think we should presume that the system’s going to crash.”

He noted that voters can also register in person or by mail-in paper form through Friday should problems with the website recur.

“A longer extension would have been great,” said Kristen Clarke, president of the Lawyers’ Committee for Civil Rights Under Law, the group that brought the suit. But she called the decision “a victory for those who wanted to register and didn’t have the opportunity to do so.”

Trouble with the registration system began Sunday after Facebook and Google alerted Virginians to the state’s looming registration deadline. On its Facebook page, the Department of Elections said Monday that “an unprecedented activity level” had left the registration website slow and, in some cases, “completely unresponsive.”

Problems escalated Monday. From 3:40 p.m. on, both parties agreed, the website was completely unresponsive. Registration closed at 11:59 p.m. Monday.

Neither the governor nor the attorney general has the power to extend voter registration; only a judge can do so.

Republican leaders in the GOP-controlled General Assembly issued a statement that they “obviously accept the Court’s order to extend the deadline.” But they also called on McAuliffe to shake up the leadership at the state elections department, noting that the agency failed to heed warnings from local officials about problems they were encountering with the registration system before Monday’s crash.

“It is clear that local election registrars and the General Assembly have lost confidence in the Department of Elections and its ability to provide the necessary technical and support services,” said a statement from House Speaker William J. Howell (Stafford), Majority Leader M. Kirkland Cox (Colonial Heights) and the rest of the Republican leadership.

“Governor McAuliffe should consider a leadership change at the Department after the November elections,” they said in the statement, adding that the legislature should review the situation when it convenes in January.

McAuliffe’s spokesman, Brian Coy, said McAuliffe “has full confidence in Edgardo and his team” and pushed back against GOP criticism.

“This expression of concern for voters would have a lot more credibility if it didn’t follow years of Republicans using disenfranchisement laws and political lawsuits to shut people out of their own democracy,” Coy said.

In the statement issued Thursday, McAuliffe blamed the troubles on “unprecedented web traffic” and said election officials had been “working overtime since Monday to expand the capacity of the system.”

“I am confident that the steps we have taken will provide an improved experience to people who use it,” he said. “However, I do want to urge Virginians who are interested in registering to vote to act as quickly as possible and, if they are able, to take advantage of all of the available ways to register to vote during this period, including visiting a local registrar’s office or a Department of Motor Vehicles office.”

Since the last presidential election, Virginia has rolled out a system that allows citizens to register to vote and update their registrations online. Four years ago, the state had an entirely paper-based system. The shift to online was hailed as a more modern and efficient approach, but registrars have complained in recent months about recurring glitches and severe slowdowns. Six days before the deadline, election officials brought an additional server online in an unsuccessful attempt to deal with increasing visitors.

The state launched its online voter registration system in 2013. Until this year, the largest number of registrations submitted in a single day was about 2,200, state elections commissioner Edgardo Cortés has said. That single-day online registration record has been broken three times this year in response to social-media campaigns urging Virginians to register: 8,000 signed up one day in February, ahead of the deadline to register for the primary; 17,000 on Sept. 23, ahead of National Voter Registration Day; 21,000 managed to do so on Monday despite the day’s technical issues.

Laura Vozzella contributed to this report.