By Scott Malone

(Reuters) - A federal judge on Thursday ordered Virginia to reopen its voter registration window and allow residents to continue to sign up through midnight Friday, after its online registration portal was unavailable to many users earlier this week.

U.S. District Judge Claude Hilton's order came in response to a lawsuit filed on Tuesday by the activist New Virginia Education Fund, which complained that the state's online voter registration portal had worked erratically in the days leading up to the state's initial Monday deadline to register.

The lawsuit argued that the problems risked illegally denying thousands of people the right to vote in the Nov. 8 election.

Virginia Governor Terry McAuliffe this year restored the right to vote to thousands of ex-felons, a move seen as potentially tipping what had been a traditional Republican stronghold in Democrats' favor.

"I am pleased that the court has agreed with the request to extend Virginia's voter registration period after unprecedented web traffic prevented many people from completing their registrations online before the original deadline," McAuliffe, a Democrat, said in a statement on Thursday.

"The Commonwealth will fully comply with the court's order and extend our registration process online, in person and through the mail."

State law gives the power to extend voting registration to the legislature, so McAuliffe had been unable to act until the judge's ruling, noted Carl Tobias, a law professor at the University of Richmond School of Law. The Republican-controlled legislature had declined to take any action following the flurry of complaints on Monday.

"The real question is if this leaves enough time to get the word out to people who had been blocked from registering and may not know that the issue has been resolved," Tobias added.

Shortly after the judge's decision was handed down in an Alexandria courtroom, the state's Department of Elections updated its Web site to show the new deadline.

Representatives of the New Virginia fund did not immediately respond to requests for comment.

Recent polls show Democratic presidential candidate Hillary Clinton leading Republican New York real estate developer Donald Trump in the state.

The decision comes the week after a judge in North Carolina gave residents in counties hard hit by Hurricane Matthew additional time to register to vote. Similar steps were also taken in parts of Georgia, South Carolina and Florida following the storm.