Police have used live bullets in a major terror drill at a university in Kenya, sparking panic across the campus and reportedly leaving some students injured in the rush to escape.

Reports of gunfire at Strathmore University in Nairobi spread on social media before the authorities were able to confirm the incident was a test.

Images posted to social media showed some of the university’s 5,000 students climbing out of windows and hanging from frames, while others waded through a stream to get away from the perceived danger.

The chaos started at around midday local time (9am GMT), and witness reports of gunfire on the campus even went out on international newswires.

“Do not panic!” local radio station Nation FM tweeted. “A terror drill is being conducted at Strathmore University.”

Others pointed out that the authorities had warned a “mock terror drill will be carried out” in posts on Facebook on Sunday night – but the message was clearly missed by many.

"It was a mock exercise," Japheth Koome, the police commander in the capital told Reuters later. "We wanted to check on alertness of emergency services."

Kenya has every reason to take terror drills seriously. In April, a group of al-Shabaab gunmen stormed a campus at Garissa University College in the east of the country, near the border with Somalia.

In pictures: Kenya Garissa University shooting Show all 10 1 /10 In pictures: Kenya Garissa University shooting In pictures: Kenya Garissa University shooting Kenya A Kenya Defense Force soldier runs for cover near the perimeter wall where attackers are holding up at a campus in Garissa Reuters In pictures: Kenya Garissa University shooting Kenya Kenyan soldiers take cover as shots are fired in front of Garissa University EPA In pictures: Kenya Garissa University shooting Kenya Students of the Garissa University College take shelter in a vehicle after fleeing from an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Kenyan police officers take cover outside the Garissa University College during an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Students gather and watch from a distance outside the Garissa University College after an attack by gunmen In pictures: Kenya Garissa University shooting Kenya Students of the Garissa University College get out of a house where they were taking shelter from an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Kenyan police officers take positions outside the Garissa University College as an ambulance carrying the injured going to a hospital, during an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Students get out of a house where they seek refuge after fleeing from an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Some students without their shirts of the Garissa University College get out of a house where they seek refuge after escaping from an attack by gunmen in Garissa In pictures: Kenya Garissa University shooting Kenya Kenya Defence Forces soldiers move behind a thicket in Garissa

At least 147 students were killed, as terrorists freed Muslim students and took Christians hostage before the siege was broken by armed police.

In 2013, Nairobi’s Westgate mall made headlines around the world when it was targeted in another al-Shabaab terror attack.