A federal judge on Sunday dismissed a highly unusual lawsuit from the Trump administration that sought to stop Alaska officials from certifying the results of a key U.S. Senate race if the Republican incumbent lost.

U.S. District Judge Sharon Gleason found that the federal government did not have the ability to bring the lawsuit, which cited the preamble of the National Voter Registration Act. The suit asked the court to bar state officials from certifying the election while an investigation examined whether voters were confused by two similarly named Senate candidates on Alaska's ranked-choice ballot: Republican incumbent Sen. Dan Sullivan and Daniel Sullivan Jr., who is not affiliated with a political party.

Gleason, a nominee of former President Barack Obama, concluded that the requested court order would likely violate Alaskan voters' right to a secret ballot. She said the government had not explained how the relief it sought could address its alleged injury while preserving ballot secrecy.

The Justice Department is planning to appeal, spokesperson Kiersten Pels said. Pels said Alaskan voters deserve a fair election and should not be misled in an attempt to rig outcomes. Voting rights groups that helped defend Alaska against the lawsuit welcomed the ruling. Sophia Lin Lakin, director of the American Civil Liberties Union's Voting Rights Project, called the lawsuit lawless from the start and a reckless use of taxpayer money aimed at silencing voters.

President Trump said he ordered the lawsuit because two of the four Senate candidates on Alaska's ballot have similar names. Alaska's Republican Party had supported an earlier state court effort to keep Sullivan Jr. off the ballot, but the Alaska Supreme Court ruled in June that he had the right to run. Allegations that Democrats were propping up Sullivan Jr. to spoil the incumbent's chances have long hung over the closely watched contest. A New York Times report about Democratic campaign operatives' efforts to recruit Sullivan Jr., which NPR has not independently confirmed, drew new attention to those allegations. Republican Gov. Mike Dunleavy has ordered an investigation and indicated that certification may depend on its outcome. U.S. Attorney Michael Heyman said at an Oct. 30 press conference in Anchorage that the Justice Department has an ongoing criminal probe. Democratic candidate and former Rep. Mary Peltola has denied any involvement.

Incumbent Sullivan told CNN's State of the Union that he would accept the election results whether he wins or loses. More than 86,700 Alaskans had cast ballots during early voting, according to the latest figures from Alaska's Division of Elections, and more were expected to vote through Tuesday's Election Day.

Sources: NPR News.