Three months ago, President Abdel Fattah el-Sisi of Egypt had three close advisers: his army chief, his spy boss and his chief of staff. Just one still has a job.
On Thursday, he fired the spy chief, Khaled Fawzy, and replaced him with his chief of staff. In October, he fired the chief of defense.
In a curt statement, Mr. Sisi’s office did not offer a reason for the dismissal of Mr. Fawzy, who had led the General Intelligence Service since December 2014 and was credited with spearheading the agency’s revival after its failure to anticipate the Arab Spring in 2011.
But there were signs the decision was made quickly, mostly notably in the choice of Mr. Sisi’s longtime aide and chief of staff, Abbas Kemal, to fill the position temporarily until another successor is found.
The abrupt change comes at a delicate moment for Egypt’s leader, who is expected to soon announce his run for re-election in a vote that starts in March, and days before a visit to Cairo by Vice President Mike Pence. The visit, originally scheduled for December, is set for Saturday.
The election is not expected to pose much of a problem for Mr. Sisi. Several potential candidates have complained of being pressured to quit, hounded through the courts, or threatened with corruption prosecutions.
The atmosphere is not conducive to “honest competition,” Anwar Sadat, a nephew of the former president, who had considered running, said in a statement on Monday.
But Mr. Sisi faces major challenges in foreign policy, an area where the intelligence service under Mr. Fawzy had forcefully re-exerted its influence, at times nudging aside the Foreign Ministry, analysts say. It midwifed a unity deal between Hamas and the Palestinian Authority in October, played a role in relations with the United States and asserted itself as a player in Egypt’s row with Ethiopia over a huge dam being built on the Nile.
The firing also comes amid a criminal investigation over a recent New York Times article based on leaked audio recordings of an Egyptian intelligence officer. The article described covert efforts to swing Egyptian public opinion in favor of the American recognition of Jerusalem as Israel’s capital, a position contrary to Egypt’s public position.
Egyptian officials disputed the report, which created an uproar in Parliament, with some legislators saying it was part of an international conspiracy to embarrass Egypt. At least one person on the leaked tapes has been interviewed by prosecutors.
A furor has also erupted over the $4.8 billion Ethiopian dam, which is due to be completed next year. Egyptian experts fear it will greatly curtail their share of the river water as the dammed area is filled, which experts say could take from three to 12 years.
Mr. Sisi emerged grim-faced from a meeting in Cairo on Thursday with the prime minister of Ethiopia, Hailemariam Desalegn, at which they failed to resolve a dispute over the dam’s impact. At a joint news conference, Mr. Sisi spoke of “extreme concern” at the lack of progress.
A dispute over Egypt’s share of the Nile waters and controversy over his position on Jerusalem are headaches Mr. Sisi could do without. And whatever the reason for Mr. Fawzy’s defenestration, it underscores how Egypt’s leader is willing to drop his closest allies if he deems it in his best interest.
Mr. Sisi’s firing of his defense chief, Gen. Mahmoud Hegazy, in October was greeted with surprise, not least because the two men are linked through marriage. One of Mr. Sisi’s sons is married to General Hegazy’s daughter.
That dismissal, like Mr. Fawzy’s on Thursday, was sudden, unexpected and unexplained. Both also followed episodes embarrassing to Mr. Sisi’s government — in the case of General Hegazy, a militant ambush of security forces that killed at least 16 people.
Thanks in part to Mr. Fawzy’s efforts to claw back influence, the General Intelligence Service had become an important channel in relations between the United States and Egypt in recent years. The spy agency hired Weber Shandwick, a public relations agency based in New York, to represent its interests, before the firm said it stopping doing work for the service in July.
But some American officials had found it hard to work with Mr. Fawzy, who backed harsh measures against foreign aid agencies in Egypt and saw Egypt’s woes as a product of foreign meddling, said Andrew Miller of the Project on Middle East Democracy.
“He was erratic, conspiratorial in nature and harbored a lot of anti-American suspicions,” said Mr. Miller, who until last year worked on Egypt at the State Department. “He believes that the 2011 uprising was the result of an external conspiracy rather than internal upheaval.”
Mr. Kemal, the new spy chief, is considered a more moderate figure. A former army officer, he served as director of Mr. Sisi’s office when he was head of Military Intelligence, between 2010 and 2012. He stayed with Mr. Sisi after the military swept him to power in 2013, but was embarrassed by a series of audio leaks, apparently recorded in his office, in which Mr. Sisi and his generals could be heard mocking other Arab countries and discussing plans to manipulate public opinion.
Mr. Sisi’s son Mahmoud, who works at the General Intelligence Service, is likely to retain an influential role. On at least one occasion, he accompanied Mr. Fawzy on a visit to Washington to meet with Obama administration officials, Mr. Miller said.
Correction: January 19, 2018
An earlier version of this article referred incorrectly to the relationship between the General Intelligence Service and the public relations agency Weber Shandwick. The agency said it stopped doing work for the service in July; it is not currently representing the service.