DETROIT — A federal judge who ordered Michigan to begin its recount effectively ended it on Wednesday, tying his decision to a state court ruling that found Green Party candidate Jill Stein had no legal standing to request another look at ballots.

The ruling seals Republican Donald Trump's narrow victory over Democrat Hillary Clinton for Michigan's 16 electoral votes.

U.S. District Judge Mark Goldsmith agreed with Republicans who argued that the three-day recount must end a day after the state appeals court dealt a blow to the effort. The court said Stein, who finished fourth in Michigan on Nov. 8, didn't have a chance of winning even after a recount and therefore isn't an "aggrieved" candidate.

Green Party presidential candidate Jill Stein Tae-Gyun Kim / AP

"Because there is no basis for this court to ignore the Michigan court's ruling and make an independent judgment regarding what the Michigan Legislature intended by the term 'aggrieved,' plaintiffs have not shown an entitlement to a recount," Goldsmith said.

It was the judge's midnight ruling Monday that started the recount in Michigan. But Goldsmith's order dealt with timing — not whether a recount was appropriate. More than 20 of 83 counties already were counting ballots again. They reported minor changes in vote totals, although many precincts couldn't be examined for a second time for a variety of reasons.

Earlier Wednesday, the Michigan elections board voted, 3-1, to end the recount if Goldsmith extinguished his earlier order.

State Republican Party Chairman Ronna Romney McDaniel and Attorney General Bill Schuette said it's a victory for voters and taxpayers. Stein now is left with asking the Michigan Supreme Court to intervene, which is a long shot.

"Jill Stein, who received only 1.07% of the vote in Michigan, is not legally entitled to hijack the will of voters and drag them into an arduous and expensive publicity stunt," McDaniel said.

Stein got about 1 percent of the vote in three states where she's pushed for recounts — Michigan, Pennsylvania and Wisconsin. Trump narrowly won all three.

She insists she's more concerned about the accuracy of the election, but Goldsmith said Stein's legal team presented only "speculative claims" about vulnerable machines, "not actual injury."

The judge said a recount to test the integrity of the voting system "has never been endorsed by any court."

A court hearing will be held Friday on a possible recount in Pennsylvania. Wisconsin's recount, which started last week, has increased Trump's margin of victory over Clinton thus far.

Clinton needed all three states to flip in order to take enough electoral votes to win the election. Trump has 306 electoral votes to Clinton's 232; 270 are needed to win. Michigan has 16 electoral votes, Pennsylvania has 20 and Wisconsin has 10. Electors convene Dec. 19 across the country to vote for president.