Three Egyptian policemen have been killed at Cairo's al-Azhar University, the Interior Ministry said, a week before the presidential election that former army chief Abdel Fattah el-Sisi is expected to win.
The assailants stepped out of two cars and opened fire on a security checkpoint just outside the university late on Monday night, security sources said.
Nine people were also wounded in the attack, the ministry said. It said the shooting happened as students were protesting in favour of President Mohamed Morsi, who was toppled by the army after mass protests against his rule last summer.
Al-Azhar, Sunni Islam's highest seat of learning, has been the scene of frequent anti-government protests since the coup.
Armed groups have also stepped up attacks on security forces since Morsi's overthrow, killing hundreds of police and soldiers.
In an interview with Reuters news agency last week, Sisi said Egypt needed support from the United States in its battle against "terrorists" who pose a threat from several areas, including the Sinai Peninsula and the border with Libya.
Egypt has accused the Morsi's Muslim Brotherhood of involvement in many of the attacks, and the group has been declared a terrorist organisation.
Security forces have devastated the Brotherhood since Morsi's fall, killing hundreds in the streets and arresting thousands. Hundreds have been given preliminary death sentences in court.