Gunmen travelling in a car today opened fire on a group of Egyptian policemen outside Cairo's Al-Azhar university, killing three and wounding nine others, the interior ministry said.
The attack comes just days ahead of a presidential election on May 26-27, which former army chief Abdel Fattah al-Sisi is expected to win.
The number of attacks targeting policemen has risen since Sisi ousted Islamist president Mohamed Morsi in July last year.
The latest came as some students of Cairo's Al-Azhar university, a prestigious seat of Sunni Islamic teaching, were protesting in favour of Morsi, the ministry said in a statement.
The wounded included an officer, the ministry added.
The attack also came a day after two policemen, riding on a motorbike, were shot dead by gunmen in the central city of Minya.
In April, a court in Minya triggered an international outcry after sentencing to death around 700 Morsi supporters after a speedy mass trial, accusing them of murder and attempted murder of policemen in August last year in Minya.
In a separate attack, militants blew up a gas pipeline late yesterday near Al-Arish airport in northern Sinai, security officials said.
The targeted pipeline transports gas to an industrial area in central Sinai, they added.
Militants have regularly targeted pipelines in Sinai since the ouster of president Hosni Mubarak in 2011, repeatedly forcing a halt in gas supplies to Israel and Jordan.
The army has poured troops into the mountainous and underdeveloped region of Sinai Peninsula to combat a growing militancy.
Officials say about 500 people, mostly members of security forces, have been killed in militant attacks across the country since the ouster of Morsi.
Militant groups Ansar Beit al-Maqdis (Partisans of Jerusalem) and a little-known Ajnad Misr (Soldiers of Egypt) have claimed several deadly attacks against security forces.
They say the attacks were in retaliation to a brutal police crackdown on supporters of Morsi.
Amnesty International says more than 1,400 people have been killed in the police crackdown since July when Morsi was ousted.