President Trump in the Cabinet room of the White House. (Jim Lo Scalzo/EPA-EFE/Shutterstock)

After the FBI raid Monday on the office of his personal attorney, Michael Cohen, President Trump denounced the investigation as a “disgrace.” He then claimed Tuesday morning, “Attorney-client privilege is dead!” It’s not — and it’s worth considering why the president is wrong.

Attorney-client privilege is a bedrock principle of our legal system. Shielding communications with a lawyer for the purpose of obtaining legal advice safeguards the constitutional right to counsel and ensures the fair operation of the justice system. If prosecutors and FBI agents were truly running roughshod over the privilege, there would be reason for all of us to be up in arms.

But no legal privilege is absolute. There’s an old saying that the Constitution is not a suicide pact; well, neither is the justice system. A rule designed to ensure the fair operation of that system cannot be wielded to undermine it by shielding criminal conduct.

The crime-fraud exception provides that communications with an attorney made in furtherance of criminal activity are not protected. You can tell your attorney about your own criminal conduct and that will be privileged. But you can’t use communications with your attorney to help you commit ongoing or future criminal acts.

Even apart from the crime-fraud exception, much of what may be in an attorney’s office is not privileged at all. The privilege applies only to communications with an attorney for purposes of obtaining legal advice. If, for example, Cohen was acting on his own in matters such as the Stormy Daniels payoff, there could be many records in his office that are not privileged. Things like his personal banking and tax records also would not be protected.

There cannot be an absolute prohibition on investigating attorneys or searching their offices. If you were investigating the Corleone family, you wouldn’t argue that the offices of consigliere Tom Hagen were sacrosanct. But at the same time, we have to recognize the sensitivity and potential dangers in allowing such a search. The solution is to put systems in place to ensure that such searches are rare and to protect any legitimate privilege claims when they do occur.

Fortunately, that’s exactly what the Justice Department does. Detailed rules govern any request for a search of an attorney’s premises. Prosecutors are required to obtain approval from the U.S. attorney for their district or from an assistant attorney general and must consult with lawyers in the criminal division of Main Justice. They are required to consider less intrusive alternatives and explain why they are not adequate. They also must implement detailed procedures to protect any legitimately privileged materials seized. This typically involves using a “privilege team” consisting of agents and/or prosecutors not involved in the underlying investigation to review any potentially privileged materials and sequester them from those actually working on the case. Prosecutors are required to detail their privilege-team procedures when seeking approval for the warrant within Justice, and they typically will include a description of those procedures in their warrant application to the judge as well.

The latter step brings us to the next level of safeguard in such cases: the role of the independent judiciary. Prosecutors can issue a grand-jury subpoena without judicial approval, but any search warrant has to be approved by a federal judge or magistrate, who must find that there is probable cause to support the warrant. When it comes to a search of an attorney’s office, any judge is going to give the warrant application extra scrutiny to ensure not only that the allegations have a solid foundation but also that procedures are in place to safeguard the privilege.

There’s a second level of judicial review available as well: Now that the search has taken place, Cohen will be able to seek judicial intervention to rule on any claims of privilege and potentially to order that privileged documents be returned.

This search was authorized by senior officials in Trump’s own Justice Department. It was reviewed and approved by an independent federal judge. Checks and balances including detailed safeguards and judicial review will protect legitimately privileged materials while ensuring that unfounded claims of privilege are not used to shield criminal acts.

Searching an attorney’s office is unusual. It’s aggressive. And it’s also completely appropriate if done properly and in the right kind of case. Allowing blanket attorney-client privilege claims would erect some kind of safe zone for criminal conduct around every attorney’s office. But no one is above the law — not the president of the United States, and certainly not his lawyer.

It’s not that the attorney-client privilege is dead, Mr. President. It’s just that the rule of law is still alive.