Elon Musk’s political group can keep awarding $1m (£722,000) to voters in swing states, a judge has ruled.

The giveaway by Mr Musk’s America PAC is set to end on Tuesday, and the final recipient has already been determined, a lawyer for the billionaire said in a court hearing on Monday.

In a surprising turn, the lawyer revealed that people receiving the money have not been chosen randomly in a lottery-style contest, as many believed, but were selected by the group.

Philadelphia District Attorney Lawrence Krasner had sued to stop what he called an “an illegal lottery” after Musk announced he would give the money to one voter in a swing state each day until Election Day.

Pennsylvania Judge Angelo Foglietta did not immediately give a reason for the ruling, made a few hours after the hearing, according to the Associated Press.

“The $1m recipients are not chosen by chance,” the lawyer, Chris Gober, said during the hearing, according to the Associated Press. “We know exactly who will be announced as the $1m recipient today and tomorrow.”

Mr Gober told the court that America PAC has already determined the final recipient will be a voter from Michigan, US media reported.

On Monday, America PAC announced a man named Joshua in Arizona had been awarded the day’s sum.

In a post on X, formerly Twitter, which Mr Musk owns, the group added: “Every day until Election Day, a person who signs will be selected to earn $1m as a spokesperson for America PAC.”

But when the world’s richest man unveiled the giveaway last month, many believed it was a random drawing for registered voters who signed a petition supporting the First and Second Amendments of the US Constitution.

“We are going to be awarding $1m randomly to people who have signed the petition, every day, from now until the election,” Musk told a campaign event.

A few days later, the US justice department warned that the group could be breaking election laws, which forbid paying people to register to vote. Krasner’s office sued to stop it.

Mr Musk has been aggressively campaigning for Republican White House candidate Donald Trump in swing states across the country, and his committee has been pushing hard in Pennsylvania, where polls suggest Trump is in a tie with his Democratic rival, Vice-President Kamala Harris.

A lawyer in Krasner’s office told Reuters that Mr Gober’s comments in court were “a complete admission of liability”.

During the hearing, prosecutors played a video where Mr Musk, who is also the chief executive of SpaceX, said that “all we ask” is that the winners serve as spokespeople for the group, Reuters reported.

But Chris Young, the director of America PAC, said in court that the recipients are screened and must have values aligned with the group, US media reported.

Those who receive the money sign non-disclosure agreements that block them from publicly discussing the terms of their contracts, according to Reuters.

Mr Musk did not attend Monday’s hearing.

Also on Monday, Joe Rogan released an episode of his podcast featuring a nearly three-hour interview with Mr Musk.

In a post promoting the podcast on X, he said he would be endorsing former President Donald Trump.

“He [Musk] makes what I think is the most compelling case for Trump you’ll hear, and I agree with him every step of the way,” Rogan wrote.