KABUL, Afghanistan — President Ashraf Ghani’s national security adviser abruptly resigned on Saturday amid reports that Mr. Ghani was firing his entire war cabinet.

Shah Hussain Mortazavi, a spokesman for the Afghan leader, confirmed that Mr. Ghani had accepted the resignation of the national security adviser, Hanif Atmar, and appointed Hamdullah Mohib, the current ambassador to the United States, as his replacement.

Mr. Mortazavi refused to comment on a report by Tolonews, a prominent local television channel, that Mr. Ghani had fired all his security ministers including, in addition to Mr. Atmar, Minister of Defense Tariq Shah Bahrami; Minister of Interior Wais Barmak; and Masoom Stanekzai, the head of the National Directorate for Security, Afghanistan’s intelligence agency. Mr. Stanekzai and Mr. Atmar held cabinet-level posts.

“For now, we only can confirm Mr. Atmar’s resignation,” Mr. Mortazavi said. “I can’t say anything about Mr. Stanekzai.”