President Donald Trump struck back at one of his sharpest critics from the Obama administration, stripping former CIA director John Brennan of his security clearance Wednesday, and instantly drawing fire for setting a de facto political loyalty test for who gets to keep security clearances after government service.

“This action is part of a broader effort by Mr. Trump to suppress freedom of speech & punish critics,” Brennan responded by tweet Wednesday. “It should gravely worry all Americans, including intelligence professionals, about the cost of speaking out. My principles are worth far more than clearances. I will not relent.”

White House press spokesman Sarah Huckabee Sanders made the announcement from the press-room podium, instantly changing the channel from the non-stop coverage of Omarosa Manigault Newman’s book and tape revelations, and replacing it with charges of presidential overreach.

“Mr. Brennan has recently leveraged his status as a former high-ranking official with access to highly sensitive information to make a series of unfounded and outrageous allegations, wild outbursts on the internet and television about this administration,” she said at the Wednesday briefing.

She added that while historically, former heads of intelligence and law-enforcement agencies “have been allowed to retain access to classified information after their government service so that they can consult with their successors regarding matters about which they may have special insights and as a professional courtesy… Neither of these justifications supports Mr. Brennan's continued access classified information."

Sanders said other critics of the president have their clearances “under review,” ticking off a list of outspoken critics of the president including: former FBI Director James Comey; former Director of National Intelligence James Clapper; former CIA Director Michael Hayden; former national security adviser Susan Rice; former FBI Deputy Director Andrew McCabe; FBI agent Peter Strzok; FBI lawyer Lisa Page and senior Justice Department official Bruce Ohr. Comey and McCabe don’t have security clearances. It’s unclear how many of the others maintain active clearances.

“ With regard to the implied threat today that I could lose my clearance, that will have no impact on what I think, say or write. ” — Former CIA director Michael Hayden

Brennan’s clearance is “held” by a sponsoring agency, in his case, the CIA, which referred all questions to the White House, as did the Office of the Director of National Intelligence. The White House declined to comment.

“This is unprecedented,” retired Lt. Gen. James Clapper told CNN after the announcement. He also said it would have no effect. “I don’t plan to stop speaking when asked my views on this administration….So if they are saying the only way I can speak is to be in an adulation mode of this president, I’m sorry, I don’t think I can sign off on that.”

Former CIA chief Gen. Michael Hayden was similarly unfazed by the move.

“If I were to lose my clearance, it would have a marginal impact on the work I do,” he emailed The Daily Beast. “If my memory is correct, I visited the agency once to get a background briefing on Africa about nine years ago. All my other visits were either to attend a ceremony, at the request of the agency or to research my book, every word of which had to be cleared by CIA and NSA.

“With regard to the implied threat today that I could lose my clearance, that will have no impact on what I think, say or write,” he wrote.

“It’s outrageous,” John McLaughlin, former acting director of the CIA, said of the action against Brennan.

He added, “The reason you withdraw security clearances is for abuse of classified material or for personal abuse like alcohol abuse or criminal behavior. None of that can be demonstrated in this case.”

He added that normally, an official is notified why the clearance is being pulled, and there’s an opportunity for a hearing and an appeal. It’s not clear if that procedure was followed in this case. Brennan’s spokesman did not immediately respond to requests for comment.

“ I think it will have a chilling effect for any former CIA person after retiring, who goes out and criticizes the current leadership in the White House. ” — former CIA chief legal officer John Rizzo

The action drew an immediate response from national-security lawyers who say it may be legal, but sets a bad precedent.

“I think it will have a chilling effect for any former CIA person after retiring, who goes out and criticizes the current leadership in the White House,” said John Rizzo, former chief legal officer for the CIA after the attacks of 9/11.

It will also block Brennan from attending the annual former CIA directors’ get-together at headquarters, where they get a classified briefing on current events—and if Brennan had plans to write a memoir, he just got cut off from all his old files, Rizzo said.

The president could even be risking a court case that could limit his own power as set out in the U.S. Constitution.

“The Supreme Court has given huge deference to the president under his Article 2 powers, but said those are limited under the rest of the constitution,” said Robert Eatinger, former senior deputy general counsel at CIA during the Obama administration. “Is the president abusing his article 2 powers to suppress critical political expression?”

Eatinger said if Brennan chooses to challenge him in court, Trump “has to pass the laugh test that this is somehow connected with a threat to classified information.

“Brennan could claim that the president was using his constitutional authority in an unconstitutional manner, and perhaps get the court for the first time to look at whether the president has exceeded his authority,” Eatinger told The Daily Beast.

“We’re better than this,” Brennan, an MSNBC contributor, said on the cable channel Wednesday. “We have to be better than this.”