Correction: An earlier version of this article incorrectly described Defense Minister Ehud Barak as Israel’s prime minister. This version has been updated.

Israeli soldiers look at the wreckage of an Egyptian military vehicle after militants burst it through a security fence into Israel from Egypt, after it was brought to an Israeli military base along the border with Egypt, on Aug. 6, 2012. (Tsafrir Abayov/AP)

The Egyptian government on Monday vowed to act swiftly to restore security in north Sinai as a brazen attack near the Israeli border that killed 16 Egyptian security personnel dealt the country’s new president a vexing first crisis.

The ambush and the gunmen’s attempt to storm across the border Sunday night brought into sharp focus challenges that could define or undo the presidency of the nation’s first Islamist statesman. The assailants are believed to be Islamist extremists who have secured a foothold near the Israeli border as the area has descended into lawlessness in recent years. No assertion of responsibility has emerged.

The incident is likely to become the first real test of the power struggle between Egypt’s military chiefs and President Mohamed Morsi, a Muslim Brotherhood leader who was among the thousands of Islamists persecuted by the state under the reign of ousted leader Hosni Mubarak. Although a crackdown on Islamists might be the military’s preferred tactic, it could cost Morsi politically.

“This is the first time something of this magnitude has happened since the Egypt-Israel peace deal was signed” in 1979, said Hassan Haridy, a former Egyptian diplomat who oversaw the Israel portfolio at the Foreign Ministry. “It was very, very, very organized. The people who did it know the land well and know the routine of the border checkpoint.”

Under enormous pressure from Israel and fellow Egyptians, Morsi and the military will be challenged to find a way to reassert state control over the increasingly lawless Sinai Peninsula. Carrying out the type of sweeping crackdown his predecessor would have launched could spark a bloody confrontation between Islamists and security forces — a particularly dangerous prospect because militants and Bedouin tribes in the area have stockpiled weapons during the past couple of years.

The attack will also test Egypt’s thorny alliance with Israel — the cornerstone of U.S. policy in the region.

Israeli officials demanded a crushing response by Egypt to a growing threat that, if left unaddressed, could prompt Israel to launch its own attack on militant cells that have taken root just miles from its border.

The Muslim Brotherhood issued a statement on its Arabic Web site Monday saying the attack had likely been the work of Israel’s intelligence agency, Mossad. It said the vulnerability of Egyptian security forces along the border “made it imperative” to review the peace treaty between the two countries.

Israeli Defense Minister Ehud Barak said Monday that the incident ought to be a “wake-up call” for Egypt, in a statement issued after he toured the border crossing that was stormed by a team of militants using a commandeered Egyptian military armored vehicle. The Israeli military launched an airstrike that killed at least eight assailants, Israeli officials said.

“I appreciate that this will not be the last time that we come across attempts to harm us,” Barak said, urging the Egyptian government to be “sharp and effective.”

Morsi and Field Marshal Mohammed Hussein Tantawi, who heads Egypt’s Supreme Council of the Armed Forces, traveled together to el-Arish, a city in the Sinai near the site of Sunday’s attack, in a show of unity. Government officials provided very little information about the attack or their intended response. Morsi’s spokesman said the government did not yet have definitive information on the identities of the militants. The government declared a three-day mourning period for the slain troops, one of the largest losses of life for Egyptian security forces in peacetime.

Gaza Strip officials condemned the attack and were quoted by the Maan News Agency as saying that Hamas, the militant group that controls the Palestinian territory, played no role. The news agency, based in the West Bank town of Bethlehem, reported that officials in Gaza ordered that the smuggling tunnels that connect Gaza and Egypt, the Palestinian enclave’s main lifeline, be closed as part of stepped-up security measures.

Sinai residents said that the military deployed special forces to the region and that military helicopters hovered Monday around the area where the attack began. The Egyptian military issued a statement saying it stood ready to “restore safety and stability in the shortest time possible.”

Retired Maj. Gen. Talaat Mosallam, a security analyst, said the kind of nuanced, comprehensive response needed to restore security in north Sinai may be beyond the capabilities of the country’s new president.

“Egypt is suffering from a vacuum in political leadership,” he said. “It’s difficult to face such a situation without political leadership.”

Residents in Sinai were dismayed by the attack. Mona ­el-Zamalot, an activist who lives in el-Arish, said the operation represented an intelligence failure by the Egyptian government. She said Israeli officials had warned their citizens in recent days not to travel to Egyptian resort towns in the Sinai because of the threat of attacks. Zamalot, a former member of the Muslim Brotherhood, said she had little faith in Morsi’s ability to respond adequately.

“This country doesn’t need Morsi,” she said, criticizing the president’s brief, unemotional remarks televised Sunday night. “If I were Morsi giving a speech yesterday, I would get people to revolt, to get angry.”

Zamalot said she has met some of the men who have joined jihadist groups that have set up small training camps in the Sinai in recent months. They are astonishingly well armed, she added.

“They want to turn Sinai into an Islamic emirate, to isolate it, and for the Egyptian army to pull out so it can be under their control,” she said. “The weapons that are available in Sinai are not even available to the Egyptian soldiers.”

Karin Brulliard in Jerusalem contributed to this report.