EL ARISH, Egypt — President Mohamed Morsi fired his intelligence chief on Wednesday and asked his defense minister to replace the commander of Egypt’s military police, upending the country’s security apparatus in response to the killings of 16 soldiers at a checkpoint near Egypt’s border with Israel.


According to his spokesman, Mr. Morsi also appointed a new head of his presidential guard. And he fired the governor of North Sinai, the province where the attack on the soldiers — the deadliest on Egypt’s military in decades — took place on Sunday.


The moves amounted to a bold attempt by Mr. Morsi to assert the power of his office, encroached on by the generals who took power after the fall of President Hosni Mubarak, and to quiet critics who had accused him of reacting timidly to the crisis.


The governor, Sayyid Abdul Wahab Mabrouk, apparently received the news in the middle of a public event, as he was preparing to help open a police station in the town of Sheikh Zowayed that had been closed since last year, when it was set on fire during the Egyptian uprising.


His car, which had pulled up outside the police station, abruptly left as the ceremony was about to get under way.


The shake-up came as Egypt’s military made a show of force in the troubled Sinai region, sending troops and armored carriers through towns and villages. Helicopters fired on unknown targets, in the first airstrikes by Egypt’s military in the region in decades. Witnesses reported sporadic heavy clashes and said the airstrikes appeared to have hit several cars, thought it was not clear whether anyone was in the vehicles.


Egyptian security officials have blamed the attack on militants in Sinai, who have grown in numbers since the Egyptian uprising, when local security officials largely disappeared from the region. They also blamed militants from the Gaza Strip, saying they participated in the attack on the soldiers and in a subsequent attempt by the gunmen to storm the Israeli border, using vehicles stolen from the checkpoint.


Security officials leaked reports to state media saying that 20 militants had been killed during the operation, but there was no corroboration of that tally from residents in the towns where the patrols occurred.


A smuggler in Rafah, on the Egyptian side of the Gaza Strip border, said Egyptian security agents had requested that he close tunnels on his property that connect to Gaza. The smuggler, who asked to be identified only by his first name, Ismael, said he had complied with the request, in part because he did not believe that the Egyptian authorities would enforce the closures for very long.


Bulldozer tracks marked his garden, running through the red dirt he had used to cover a tunnel.


The airstrikes by the Egyptian military early Wednesday followed renewed violence in the northern Sinai Peninsula on Tuesday night, when, at around 11 p.m. in what appeared to be a series of coordinated assaults, gunmen fired on at least seven government checkpoints as well as a military cement factory, according to security officials. At least two people were injured in the attacks, the officials said.


On Tuesday, President Morsi abruptly canceled plans to attend the funeral of the 16 soldiers after protesters shouting anti-Muslim Brotherhood slogans chased the country’s prime minister from an earlier prayer service.


“You killed them, you dogs,” the protesters shouted at the prime minister, Hesham Qandil, state news media reported. Mr. Qandil is not a member of the Brotherhood, though some people in Cairo — especially critics of the Islamist group — say he is ideologically close to it. Pictures from the ceremony showed Mr. Qandil surrounded by security guards as protesters waving shoes pursued him.


A sign carried by a protester read, “This funeral is for Egyptians, not the Brotherhood and their president.”


Mr. Morsi’s spokesman, Yasser Ali, explained later that the president, who visited four injured soldiers in a military hospital, had not wanted to interfere with the public’s ability to attend the ceremony. “It was also tense,” he said. “We all realize the magnitude of the sadness, so the president preferred not to come.”


Mr. Morsi’s absence from the funeral on Tuesday left his defense minister, Field Marshal Mohamed Hussein Tantawi, as the most senior official in attendance, shown on television walking behind the coffins, draped with flags. Though the number of hecklers was reportedly small, Mr. Morsi’s decision to stay away was a reminder of the challenges he faces as the country’s first Islamist leader navigating Egypt’s deeply polarized politics.