President Trump abruptly revoked the security clearance of former CIA director John Brennan, and he has threatened to strip a bevy of other former national security officials of theirs as well.

The president said he has a “unique, constitutional responsibility to protect the nation’s classified information,” while announcing he yanked the clearance for Brennan, an open Trump critic who led the CIA for nearly four years under the Obama administration.

The move has sparked a debate over whether former officials should still have security clearances even after they’ve left their jobs.

“The president has the ultimate authority to decide who holds a security clearance,” the Office of the Director of National Intelligence (ODNI) told The Associated Press.

Read on for a look at what security clearances are and why former officials can still keep them.

Who gets security clearances?

Security clearances are for individuals who – for a variety of reasons – need access to classified information.

They are given to people who have undergone a background check and “whose personal and professional history affirmatively indicates loyalty to the United States, strength of character, trustworthiness, honesty, reliability, discretion, and sound judgment,” according to an executive order pertaining to access to classified information.

Aside from allegiance to the U.S., officials also look at sexual behavior, financial situations, alcohol and drug use, mental health and potential foreign influences when determining if a person can get a security clearance.

The process to be granted a security clearance is complex and very detailed, Bradley Moss, a lawyer specializing in security clearances, told Fox News. A more than 100-page form has to be filled out, and investigators interview the individual in addition to friends, family and other references.

Some agencies, such as the CIA and FBI, can also require individuals to sit for a polygraph test, Moss said.

Private companies, too, can petition the government to get security clearances for employees.

According to a Government Accountability Office report, about 4.2 million people had or were eligible for a security clearance by October 2015, as estimated by the ODNI.

Are all security clearances the same?

No. There are different levels of security clearances. Federal agencies can determine how to ensure access to classified information is “clearly consistent with the interests of the national security,” according to the executive order.

The three main levels of classified information, starting with the highest, are: top secret, secret and confidential.

People who receive the highest-level clearances don’t necessarily get to see every piece of sensitive material, John Berry, an attorney who specializes in security clearances, told Fox News. In most cases, these individuals are granted information “that you have a need to know for something that you are working on.”

In comparison, those with a lower-level security clearance “don’t deal very much with classified information at all,” Berry explained.

Security clearances are costly, too. According to ClearanceJobs.com, a job search website for those with security clearances, the process of obtaining one, including the Office of Personnel Management investigation, can cost government agencies and federal contractors together thousands of dollars.

How long do they last?

Security clearances are subject to renewal every few years, though they theoretically can last a person’s entire life.

For example, the Department of Defense says a Period Reinvestigation (PR) must occur every five years for a top secret clearance, 10 years for a secret clearance and 15 years for a confidential clearance.

Why do former officials even still have security clearances?

Just because an official has left the federal government, doesn’t mean his or her security clearance is automatically revoked. In many cases, clearances remain automatically “active” for up to several years.

Former National Security Council staffer Elliott Abrams said he and others continued to keep their security clearances even after the Bush administration “for at least a year” because “the incoming Obama White House thought that in the early months of a new administration, we might have some useful insights to impart – information about how past events had developed, or impressions of top people in foreign governments—and our successors wanted to be able to discuss classified information with us and elicit our views.”

“It’s not so much a benefit to the person. It’s more of a benefit to the particular government officials that would need some insight from times prior to them," Berry explained.

Moss also pointed out that someone maintaining their clearance after leaving office doesn’t necessarily have access to classified information – unless a current agency requests it.

Security clearances can also provide a financial bump for some in the private sector. According to ClearanceJobs.com, the average salary for those with active security clearances is $93,004.

The ClearanceJobs.com report also cautioned that in order to see a higher salary, employees must have not only the right kind of security clearance, but also the right skill set.

Fox News’ Gillian Turner contributed to this report.