WASHINGTON — President Donald Trump fired the country’s senior military officer as part of an extraordinary Friday night purge at the Pentagon that injected politics into the selection of the nation’s top military leaders.

Gen. Charles Q. Brown Jr., a four-star fighter pilot known as C.Q. who became only the second African American to hold the chairman’s job, is to be replaced by a little-known retired three-star Air Force general, Dan Caine, who endeared himself to the president when they met in Iraq six years ago.

In all, six Pentagon officials were fired, including Adm. Lisa Franchetti, the first woman to lead the Navy; Gen. James Slife, vice chief of the Air Force; and the top lawyers for the Army, Navy and Air Force.

The decision to fire Brown, which Trump announced in a message on Truth Social, reflects the president’s insistence that the military’s leadership is too mired in diversity issues, has lost sight of its role as a combat force to defend the country and is out of step with his “America first” movement.

Joint Chiefs chairs traditionally remain in place as administrations change, regardless of the president’s political party. But current White House and Pentagon officials said they wanted to appoint their own top leaders.

In a statement, Defense Secretary Pete Hegseth thanked Franchetti and Slife “for their service and dedication to our country” and requested nominations for their replacements.

Hegseth has previously said that Brown should be fired because of a “woke” focus on diversity, equity and inclusion programs in the military and has questioned whether he was promoted because of his race.

“First of all, you’ve got to fire the chairman of the Joint Chiefs,” Hegseth said in an appearance on the “Shawn Ryan Show” in November. He added that any general involved with DEI efforts should be fired. “Either you’re in for warfighting, and that’s it,” he said. “That’s the only litmus test we care about.”

In his 2024 book “The War on Warriors,” Hegseth questioned whether Brown was selected as the Joint Chiefs chair because he was Black.

“Was it because of his skin color? Or his skill?” he wrote. “We’ll never know, but always doubt — which on its face seems unfair to CQ. But since he has made the race card one of his biggest calling cards, it doesn’t really much matter.”

On Hegseth’s first day at the Pentagon, however, he stood next to Brown, who became chair in October 2023, and said he looked forward to working with him.

But it soon became clear that Brown had not been welcomed into Trump’s inner circle. He has not been invited to key meetings with the president, officials said.

It was a significant reversal for Trump from 2020, when he nominated Brown to be the Air Force’s chief of staff. At the time, the president noted the historic significance of his decision to appoint the “first-ever African American military service chief,” writing on social media that the general was “a Patriot and Great Leader.”

Brown had told aides repeatedly that he would not resign. On Friday, he was in El Paso, Texas, and at the southwestern border, reviewing the military’s latest mission of helping to carry out Trump’s immigration directives.

Trump did not say in his post why he was firing Brown. “He is a fine gentleman and an outstanding leader, and I wish a great future for him and his family,” the president wrote.

Brown found out he was being removed when Hegseth telephoned him at his hotel in El Paso on Friday evening, a military official said.

Caine retired with three stars, as a lieutenant general. By statute, anyone picked to be the chair of the Joint Chiefs of Staff is supposed to have served as a combatant commander; as the vice chair of the Joint Chiefs of Staff; or as the top uniformed officer of the Army, Navy, Air Force, Marine Corps or Space Force.

It was unclear whether Caine would need a congressional waiver.