President Trump is defending White House national security adviser H.R. McMaster amid a steady drumbeat from conservatives who are calling on the president to fire him for alleged disloyalty.

“General McMaster and I are working very well together,” Mr. Trump said in an unusual statement issued shortly before midnight Friday. “He is a good man and very pro-Israel. I am grateful for the work he continues to do serving our country.”

The two men met on Thursday amid Gen. McMaster’s purge of Trump loyalists from the White House national security council, a heated debate about sending more U.S. troops to Afghanistan and a report that he allowed former Obama administration aide Susan E. Rice to keep her security clearance.

Gen. McMaster sent a letter to Ms. Rice in April giving her unfettered and continuing access to classified information and waiving the “need-to-know” requirement on anything she viewed or received during her tenure as President Obama’s national security adviser. A copy of the letter was obtained by Circa; Mr. Trump reportedly was not aware of Gen. McMaster’s action.

The topic of Ms. Rice has been a particularly sore spot for Mr. Trump, who was angered to learn that she unmasked the identities of Trump transition aides in conversations with Russian officials. The president has called it “a massive story.”

Gen. McMaster also has come under increasing fire from conservatives this week after Bloomberg reported that he concluded Ms. Rice did nothing wrong with the unmasking.

The head of a conservative group called for Gen. McMaster to be fired, citing the leaks Thursday of transcripts of Mr. Trump’s phone conversations with foreign leaders.

“The only option President Trump has is to clean house at the National Security Council, starting at the top with General McMaster,” said Americans for Limited Government President Rick Manning. “The threat posed to the country by the National Security Council leaking requires immediate and swift action.”

But a group of national security analysts at the conservative Heritage Foundation on Thursday called Gen. McMaster “the right leader for a tough, determined president who only wants the best for the American people.”

“For months, there have been reports of strong disagreements in the White House. There’s nothing wrong with that. In our view, that’s often the best way tough decisions get made,” wrote analysts Jim Carafano, Walter Lohman, Tom Spoehr, Luke Coffey, David Shedd and Nile Gardiner.

Conservatives also are expressing concern about the ouster of several NSC staffers who were allies of either presidential strategist Steve Bannon or fired NSC adviser Michael Flynn. Some are accusing Gen. McMaster of being a “globalist” and failing to support Israel strongly enough.

Breitbart, the news organization formerly run by Mr. Bannon, has published several stories this week calling into question Gen. McMaster’s actions.

Gen. McMaster this week ousted Ezra Cohen-Watnick, the NSC’s senior director for intelligence who was considered a Trump loyalist. He had been brought into the White House by the previous national security adviser, Mr. Flynn, who was fired by Mr. Trump in February.

“General McMaster appreciates the good work accomplished in the NSC’s Intelligence directorate under Ezra Cohen’s leadership,” the White House said in a statement. “He has determined that, at this time, a different set of experiences is best-suited to carrying that work forward. General McMaster is confident that Ezra will make many further significant contributions to national security in another position in the administration.”

Mr. Cohen-Watnick was involved in a controversy over a visit by House Intelligence Committee chairman Rep. Devin Nunes, California Republican, to the White House in March to look at intelligence reports about surveillance of Trump aides during the presidential campaign.

Two weeks ago, NSC director of strategic planning Rich Higgins was fired. He was ally of senior presidential adviser Steve Bannon.

Gen. McMaster reportedly has been ousting NSC staffers connected to a memo outlining how Mr. Trump was under attack from “globalists” and “Islamists” trying to undermine his agenda.

Last week, Derek Harvey, a key Middle East adviser at the NSC, was removed from his job.

“General McMaster greatly appreciates Derek Harvey’s service to his country as a career Army officer, where he served his country bravely in the field and played a crucial role in the successful surge in Iraq, and also for his service on Capitol Hill and in the Trump administration,” NSC spokesman Michael Anton said in a statement. “The administration is working with Colonel Harvey to identify positions in which his background and expertise can be best utilized.”

Gen. McMaster and other members of the president’s national security team have been pushing him to send about 3,500 more U.S. troops to Afghanistan, a move that the president has been resisting.