President Donald Trump warned the political press corps on Friday not to rejoice too loudly about a court decision that forced him to temporarily restore the press pass the White House confiscated last week from CNN reporter Jim Acosta.

He predicted he will ultimately win CNN's lawsuit challenging the White House's action, which a federal judge ruled had singled out Acosta and denied him a constitutionally guaranteed 'due process' to defend himself.

Trump said the White House is now 'writing up rules and regulations' to create a process that can be used to punish unruly reporters who don't maintain what he called 'decorum' during press conferences.

'We’re setting up a certain statndard which is what the court is requesting,' he said, adding that 'with the rules and regulations, we will end up back in court and we will win.'

Judge Timothy Kelly said Friday that Jim Acosta's free-press rights under the First Amendment to the U.S. Constitution outweigh 'the government’s interest in orderly, respectful press conferences.'

He declared in a stinging defeat for the president in his war on 'fake news' that the White House failed to give Acosta 'due process,' something guaranteed in government proceedings under the Fifth Amendment.

And he suggested that the White House exaggerated its contention that Acosta physically interfered with a female intern last week as she tried to reclaim a press conference microphone.

President Donald Trump brushed off a judge's ruling on Friday that restored CNN journalist Jim Acosta's revoked press pass, saying he'llwin in the end once there's an established process for punishing unruly reporters

Acosta was wearing his White House 'hard pass' (the gray ID card, pictured) when he returned to 1600 Pennsylvania Avenue Friday after winning a temporary restraining order

The reporter became the reported on Friday as journalists swarmed Acosta upon his return to the White House

Trump had his own gaggle of reporters quizzing him about the court ruling, but he said the White House was writing 'rules and regulations' to govern future cancellations of press passes

Acosta returned to the White House a few hours later, mobbed by photographers and wearing his 'hard pass,' the same one taken from him last Wednesday by a uniformed Secret Service officer who stopped him at the Pennsylvania Avenue gate.

'I want to thank all of my colleagues in the press who supported us this week,' he said outside the federal courthouse in Washington. 'And I want to thank the judge for the decision he made today. And let's go back to work.'

While Kelly ordered the White House to let Acosta back in the building, he said Trump and his spokespeople aren't obligated to call on him during press conferences or let him ask questions. He also said the White House isn't under any obligation to host reporters at 1600 Pennsylvania Avenue, but it also can't play favorites.

Trump signaled Friday that he is still upset by Acosta's decision last week to badger him instead of handing the microphone to a female intern when he was told his question time in a press onference was over.

'You can't take three questions and four questions. You can't stand up and not sit down,' he vented.

'When I see the way some of my people get treated at news conferences, it's terrible.'

He also warned that he has 'the option of leaving' a press conference early if Acosta's tactics become the norm, 'and the other media and press in the room won't be happy.'

White House Press Secretary Sarah Huckabee Sanders watched as Trump spoke about the CNN ruling; she claimed a small victory earlier based on Judge Timothy Kelly's ruling that reporters have no 'absolute' First Amendment right to do their work from inside the White House

A government lawyer told Judge Timothy Kelly on Wednesday that Trump, pictured during a fateful Nov. 7 press conference, would be within his legal rights to ban all reporters from the White House; Kelly agreed in principle but said that once the administration let them in it had to treat all reporters equally

White House Press Secretary Sarah Sanders tried to squeeze a drop of lemonade out of Judge Kelly's lemons.

'Today, the court made clear that there is no absolute First Amendment right to access the White House,' she said in a statement. 'In response to the court, we will temporarily reinstate the reporter’s hard pass. We will also further develop rules and processes to ensure fair and orderly press conferences in the future.'

Sanders ended by saying that in the Trump administration, 'There must be decorum at the White House.'

There was near-unanimity in the political press corps' backing of CNN, with more than a dozen news outlets signaling they would formally submit a supportive brief to Judge Kelly. Only One America News Network, a conservative outlet, publicly sided with Trump.

Kelly, a Trump appointee, emphasized that his ruling was temporary, saying: 'I have not determined that the First Amendment was violated here.'

'I want to emphasize the very limited nature of this ruling,' he said, explaining that he only granted CNN's emergency request on the basis that the White House's decision seemed arbitrary.

He also explained that if the White House had canceled Acosta's press pass based on a belief that he was a safety or security threat, it might have been forgiven for acting without notice.

But Kelly sided with CNN, ensuring Acosta will be able to re-enter the White House grounds. He noted that the government's attorneys couldn't tell him on Wednesday who had made the final decision to yank Acosta's credentials, an indication that no formal process was involved.

'Whatever process occurred within the government is still so shrouded in mystery that the government could not tell me at oral argument who made the initial decision to revoke Mr. Acosta's press pass,' he said.

Acosta left the U.S. District Court in Washington, D.C. after hearing the positive ruling

In a tense but brief hearing, Kelly also said the White House's claim that Kelly physically put his hands on a female intern during the Nov. 7 press conference was of 'questionable accuracy.'

In a statement, CNN said, 'We are gratified with this result and we look forward to a full resolution in the coming days. Our sincere thanks to all who have supported not just CNN, but a free, strong and independent American press.'

On the air, the network's correspondents gloated.

Media reporter Brian Stelter crowed that Trump 'doesn't want to acknowledge what real news is, so he lashed out' at Acosta, a reporter he has battled over and over.

CNN argued in court that the Trump administration was capriciously punishing Acosta because of his public advocacy in opposition to the president's policies.

CNN attorney Ted Boutrous said outside the courthouse that 'this is a great day for the First Amendment and for journalism.'

Judge Kelly did give the White House some legal options, including the establishment of a formal procedure for making decisions like the one it unilaterally handed down.

Acosta and his network sued the president and other White House officials after he was banned from the building following a contentious press conference in which he argued with President Trump and refused to surrender a microphone

He also hinted that CNN would ultimately prevail on First Amendment grounds, saying that while the administration isn't under any obligation to host reporters on White House grounds, it's unconstitutional to exclude some reporters while accepting others.

A Trump administration lawyer argued on Wednesday that Acosta has disrupted media events and interfered with one press conference last week by refusing to surrender a microphone and touching the intern who tried to reclaim it.

The government attorney also argued that the president would be within his legal rights to send the entire press corps packing.

'If the president wants to exclude all reporters from the White House grounds, he has the authority to do that,' the attorney said during a closely watched court hearing.

He was describing a scenario where the administration would move reporters, editors, TV producers and camera operators to another government facility and not speculating about limiting their ability to report or publish, according to a White House aide who declined to be identified on Thursday.

Any theoretical disruption to the close-in access journalists enjoy in the headquarters of the world's most powerful government would send news organizations howling.

That prospect didn't faze the official who spoke to DailyMail.com and said: 'What, like they're going to hate us more?'

Trump said Wednesday that CNN's Jim Acosta, who has been banned from the White House complex for the past eight days, is 'bad for the country.'

The lawyer said hours later that 'there’s no First Amendment right' to be physically present in the building Trump works.

Acosta, he said, 'is just somebody who gets up and grandstands. He doesn’t even know what he’s asking you half of the time.'

CNN attorney Ted Boutrous spoke to reporters following a hearing Wednesday as a protester held up a sign for news cameras

Acosta saw his press pass revoked last Wednesday after he clashed with an intern over a press conference microphone and harangued President Donald Trump

The president's comments on the controversy were his first since his legal team fired a salvo at CNN hours earlier, responding to a lawsuit the network filed after Acosta lost his press credentials. That followed a clash with a female White House intern over a microphone during a Nov. 7 press conference.

'We’ll see how the court rules,' Trump told The Daily Caller, asking whether 'it['s] freedom of the press when somebody comes in and starts screaming questions and won’t sit down.'

'He was very rude to the young lady,' he said of the intern, who the White House has declined to identify.

'I really think that when you have guys like Acosta, I think they’re bad for the country. ... He’s just an average guy who’s a grandstander,' Trump said, while acknowledging that Acosta is a reporter 'who’s got the guts to stand up and shout.'

In a legal filing Wednesday, the White House argued that '[n]o journalist has a First Amendment right to enter the White House.'

Trump, the administration claimed, doesn't have to justify his decision constitutionally 'whenever he exercises his discretion to deny an individual journalist one of the many hundreds of passes granting instant access to the White House complex.'

The White House's argument is centers on a reading of the First Amendment to the U.S. Constitution that guarantees the freedom to publish, but not to attend White House functions on-demand.

'The President and his staff have absolute discretion over which journalists they grant interviews to, as well as over which journalists they acknowledge at press events,' Trump's Justice Department lawyers argued.

President Trump, pictured Wednesday during a Diwali ceremony at the White House, has tussled with Acosta regularly and shows no sign of relenting

The White House argued Wednesday that it was within its constitutional rights to bar Acosta, just as it can choose who gets Oval Office interviews, who can attend press conferences and who the president will call on for questions

The government's response to CNN's lawsuit points out that the network still has 'roughtly 50 other employees' with hard passes, and that they're capable of covering the White House from inside the 1600 Pennsylvania Avenue campus

The Trump campaign started raising money over the legal battle on Wednesday

'That broad discretion necessarily includes discretion over which journalists receive on-demand access to the White House grounds and special access during White House travel for the purpose of asking questions of the President or his staff.'

The administration contended that CNN has't suffered from Acosta's forced exile since roughly 50 of its other employees still have 'hard passes' that grant them on-demand entry.

The network 'is not limited in what it can broadcast, or even what it can report from the numerous CNN-affiliated reporters who continue to hold hard press passes,' the response to Tuesday's lawsuit reads.

And it blames Acosta for making a 'decision to engage in conduct that disrupts press events and impedes other reporters from asking questions,' saying that's 'a more-than-sufficient reason for revoking his hard pass.'

Acosta lost access to the building hours after refusing to give up the microphone when the president said he had answered enough of his questions.

White House press secretary Sarah Sanders said in a statement last week that Acosta 'physically refused to surrender a White House microphone to an intern.' That appeared to be softer language than her earlier claim that he placed 'his hands on a young woman just trying to do her job.'

CNN vigorously disputed the implication that there was anything more than minor physical contact.

Acosta, who has frequently clashed with President Trump during persistent questioning, lost access to the White House on Wednesday night