Five other people were also injured in the bombing which has yet to be claimed by any group
A bomb placed under a car exploded in Egypt's second city Alexandria on Saturday, killing two people including a policeman, two days before the country is due to hold a presidential election.
The bombing, which wounded five other people, targeted Alexandria's security chief, police Major General Mostafa al-Nemr, the interior ministry said. Nemr was not hurt and said later he would not be deterred from "doing his duty" in safeguarding next week's vote.
There was no immediate claim of responsibility for the bombing.
Islamic State released a video last month in which it warned Egyptians against taking part in the upcoming vote and urged Islamists to attack security forces and leaders.
State news agency MENA quoted Nemr as saying that two people, a policeman and a driver, were killed in the blast.
"These desperate attempts by the forces of terrorism and the states that back it to affect the positive atmosphere the country is witnessing will only increase the Egyptian state's resolve to complete its political process and economic progress," Prime Minister Sherif Ismail said.
Photos on social media that could not be independently verify showed a burnt out car and smoke at the site of the blast.
Eyewitnesses said police and military personnel formed a cordon around the site of the explosion. Local television stations later showed Nemr unharmed and inspecting the area.
Residents close to the scene in Alexandria, Egypt's second-largest city, reported hearing a huge blast when the bomb detonated mid-morning.
"I suddenly heard a very strong explosion and ran towards the street, but I retreated out of fear," said Mohamed Ismail, a doorman at a building near the explosion.
"I thought the building would collapse and kept checking on its pillars," he added.
Car bomb targets motorcade transporting local security chief in Alexandria. Two casualties reported thus far (initial)pic.twitter.com/mVICUUYpt4
— Michael A. Horowitz (@michaelh992) March 24, 2018
Islamic State attempted to assassinate Egypt's defence and interior ministers in December during a trip the pair made to the Sinai Peninsula, where the hardline militant group has been waging an insurgency for almost five years.
President Abdel Fattah al-Sisi said on Friday that Islamic State militants would soon be defeated in the Sinai as he visited troops battling the militants there.
Polls will open on Monday when voters choose between Sisi and one little-known candidate who supports the former field marshal. All credible opponents dropped out in January, citing intimidation by the authorities after the main challenger was jailed.
Insurgency in the Sinai continues
Sisi's critics say he has cracked down harshly on dissent and that tough economic reforms have eroded his popularity. Supporters say such measures are needed to stabilise Egypt, which was rocked by years of unrest after protests toppled veteran leader Hosni Mubarak in 2011.
As military commander, Sisi led the ousting of Egypt's only competitively elected leader, president Mohamed Morsi, a member of the Muslim Brotherhood, who was toppled amid demonstrations against his rule in 2013, a year after taking power. Sisi took office with a landslide election victory a year later.
State news agency MENA blamed the Brotherhood, which is now banned in Egypt and designated a terrorist group, for Saturday's bombing.
"This attempt comes in the context of terrorist Muslim Brotherhood elements trying to disrupt the electoral process and influence citizens into not going to the polls and participating in the presidential election," the agency said.
Since the ouster of Morsi and a crackdown on his Muslim Brotherhood, security forces have sought to quell attacks by militants who have declared allegiance to IS.
The militants of Ansar Beit al-Maddis have killed hundreds of soldiers, policemen and civilians, mainly in its North Sinai stronghold but also elsewhere in Egypt.
A banner supporting the re-election of President Sisi who runs in next week's elections effectively unopposed (Reuters)
IS claimed the 2015 bombing of a Russian airliner carrying tourists from the South Sinai resort of Sharm el-Sheikh, which killed all 224 people on board.
It has also killed scores of members of Egypt's minority Coptic Christian community in church bombings and shootings.
Last April, during Palm Sunday celebrations, suicide bombers killed 45 worshippers in attacks on churches in Alexandria and Tanta, also north of Cairo, and since then Egypt has been under a state of emergency.
Sisi gave the armed forces and police a three-month deadline in November to wipe out the militants.
The president's ultimatum came after suspected IS gunmen massacred more than 300 worshippers in a Sinai mosque associated with Sufi Muslims, who are seen by IS as heretics.
The deadline has since been extended and the armed forces have launched their most comprehensive campaign yet to end the five-year-old militant insurgency.
The military gives regular updates on the operation, saying it has killed more than 100 militants so far while losing at least 20 troops.