After a day of fighting, which involved F-16 jets and Apache helicopters, the army said it would not stop its operations until it had cleared the area of all "terrorist concentrations".
By late Wednesday, an army spokesperson said the situation in North Sinai was "100 per cent under control". Security sources and witnesses later said aerial bombardments on militant targets had resumed.
Islamic State's Egyptian affiliate, Sinai Province, had claimed responsibility, saying it attacked more than 15 security sites and carried out three suicide bombings.
Read: One year of the Islamic State
The militants' assault, a significant escalation in violence in the peninsula that lies between Israel, the Gaza Strip and the Suez Canal, was the second high-profile attack in Egypt this week. On Monday, a bomb killed the prosecutor-general in Cairo.
It raised questions about the government's ability to contain an insurgency that has already killed hundreds of police and soldiers.
The insurgents want to topple the Cairo government and have stepped up their campaign since 2013, when then-army chief Abdel Fattah al-Sisi removed President Mohamed Mursi of the Muslim Brotherhood after mass protests against his rule.
Sisi, who regards the Brotherhood as a threat to national security, has since overseen a harsh crackdown on militants.
An army statement said the fighting had been concentrated in the towns of Sheikh Zuweid and Rafah and that the militants used car bombs and various weapons.
Of the 17 soldiers killed, four were officers, and 13 more soldiers were wounded, the statement said.
Some security sources put the death toll for army and police much higher.
The army spokesperson told state television that a number of militants had been arrested. He also posted pictures on his official Facebook page which he said showed the bodies of scores of militants. They were dressed in fatigues.
Security sources said the militants had planned to lay siege to the town of Sheikh Zuweid. "But we have dealt with them and broke the siege," one of the sources said.
Booby traps at Sheikh Zuweid
Earlier, security sources said militants had surrounded a police station in Sheikh Zuweid and planted bombs around it.
The militants also planted bombs along a road between Sheikh Zuweid and al Zuhour army camp and seized two armored vehicles, weapons and ammunition, the sources said.
Read: Cameron tells BBC to stop referring to ISIL as 'Islamic State'
Suleiman al Sayed, a 49-year-old Sheikh Zuweid resident told Reuters earlier on Wednesday that he was not allowed to leave his home while clashes were ongoing. He said he had glimpsed "five Land Cruisers with masked gunmen waving black flags."
Witnesses and security sources also heard two explosions in the nearby town of Rafah, which borders Gaza. The sources said all roads leading to Rafah and Sheikh Zuweid were shut down. The interior ministry in the Gaza Strip, run by the Islamist Hamas group, reinforced its forces along the border with Egypt.
"It is a sharp reminder that despite the intensive counter-terrorism military campaign in the Sinai over the past six months, IS ranks are not decreasing - if anything they are increasing in numbers as well as sophistication, training and daring," Aimen Dean, a former al Qaeda insider who now runs a Gulf-based security consultancy, said in a note.
State of emergency
Islamic State had urged its followers to escalate attacks during the Islamic holy month of Ramazan which started in mid-June, though it did not specify Egypt as a target. In April, the army extended by three months a state of emergency imposed in parts of Sinai.
Besides bombardments in the region, the army has destroyed tunnels into the Palestinian-ruled Gaza Strip and created a security buffer zone in northern Sinai. It is also digging a trench along the border with Gaza to deter smuggling.
Under the terms of Egypt's 1979 peace accord with Israel, the Sinai is largely demilitarized. But Israel has regularly agreed to Egypt bringing in reinforcements to tackle the Sinai insurgency, and one Israeli official signaled there could be further such deployments following Wednesday's attacks.
Read: Islamic State says it could buy nuclear weapon from Pakistan within a year
"This incident is a game-changer," an official told Reuters on condition of anonymity.
Sisi's government does not distinguish between the now-outlawed Brotherhood, which says it is committed to peaceful activism, and other militants.
The courts have sentenced hundreds of alleged Brotherhood supporters to death in recent months. Mursi himself, and other senior Brotherhood figures, also face the death penalty.
The cabinet, which met in the Police Academy for security reasons on Wednesday, approved a draft anti-terrorism law, which it said would "achieve quick and just deterrence".
"Any terrorist or criminal attacks that aim to sow chaos ... will be confronted," the cabinet said, citing the interior minister.
In Cairo, the interior ministry said security forces killed nine leading members of the Muslim Brotherhood in an apartment in a western suburb after the men opened fire on them.
The interior ministry said the group were holding a meeting to plot attacks. It said some of those killed had been convicted in court cases. The Brotherhood denied the group was armed and said in a statement the killing was a turning point that could lead to repercussions by the "oppressed".
"The assassination ... will drive the situation down an extremely dangerous slope and toward a total explosion."
COMMENTS (3)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ