Defense Secretary Pete Hegseth has told Gen. Mark A. Milley, the retired chairman of the Joint Chiefs of Staff, that he is removing his security detail, revoking his security clearance, and ordering an inspector general inquiry into his record, the Pentagon said late Tuesday.

Mr. Hegseth’s spokesman, John Ullyot, said in a statement that the secretary directed the investigation to determine whether “it is appropriate” to review the rank upon retirement for General Milley, who stood up to President Trump in his first term. Essentially, Mr. Hegseth is asking whether General Milley should be demoted.

“We have received the request and we are reviewing it,” Mollie Halpern, a spokeswoman for the acting Defense Department inspector general, said of the referral to examine General Milley’s actions as chairman.

The general retired in 2023, and at a ceremony marking the occasion he reminded troops that they took an oath to the Constitution and not to a “a king, or a queen, or to a tyrant or dictator, and we don’t take an oath to a wannabe dictator.” Senior Pentagon officials late Tuesday sought to cast Mr. Milley as an insubordinate political operator while in the chairman’s job.

“Undermining the chain of command is corrosive to our national security, and restoring accountability is a priority for the Defense Department under President Trump’s leadership,” Joe Kasper, Mr. Hegseth’s chief of staff, said in a statement late Tuesday.

General Milley could not be reached for comment on Tuesday.

Just days before General Milley’s retirement ceremony, Mr. Trump, then still planning a political comeback, suggested that the general had committed treason and should be put to death.

Amid continued threats from Mr. Trump of retribution against his enemies upon returning to office, General Milley received a pre-emptive pardon from President Joseph R. Biden Jr. hours before he left office last week. (In his first week back in the White House, Mr. Trump had the general’s portrait removed from the hallway in the Pentagon outside the chairman’s offices.)

Since General Milley has been pardoned, he cannot be court-martialed. But a finding against him could lead to a decision to reduce his rank, even in retirement.

General Milley and other former Trump administration officials had been assigned government security details because they remained under threat following the U.S. drone strike that killed the powerful Iranian general Qassim Suleimani in early 2020.

Two Republican Senate allies of President Trump urged him on Sunday to rethink his decision to strip security details from the former advisers who have been targeted by Iran, saying the move could chill his current aides from doing their jobs effectively.

Senator Tom Cotton, Republican of Arkansas and the chairman of the Senate Intelligence Committee, and Senator Lindsey Graham, Republican of South Carolina, spoke after Mr. Trump abruptly halted government security protection for three officials from his first term who were involved in his Iran policy and have remained under threat.

Fox News earlier reported that Mr. Hegseth was moving to revoke General Milley’s security detail and order the inspector general review.

As the newly sworn-in defense secretary, Mr. Hegseth has been a sharp critic of General Milley.

General Milley’s split with Mr. Trump had its roots in his decision to apologize also for inserting himself into politics when he walked alongside Mr. Trump in 2020, through Lafayette Square, for a photo op after the authorities used tear gas and rubber bullets to clear the area of peaceful protesters. “I should not have been there,” he said later. “My presence in that moment and in that environment created a perception of the military involved in domestic politics.”

Mr. Trump’s supporters have also attacked General Milley over his contacts with his Chinese counterpart during the first Trump administration, assuring them that the United States was not seeking to strike them, or trigger a military crisis.

General Milley, 66, was promoted to chairman of the Joint Chiefs by Mr. Trump in 2019. At the time, the president was impressed with his military record and his bearing. But he quickly soured on him. A book published by Philip Rucker and Carol Leonnig, “I Alone Can Fix It,” reported that General Milley was worried that President Trump might attempt to stage a coup after he lost the 2020 election. He made efforts to ensure a peaceful transfer of power, and issued a statement condemning the Jan. 6, 2021, riot at the Capitol.