Graphic showing Boston, where gunman killed p
Graphic showing Boston, where gunman killed pAFP file

A gunman shot and killed a Massachusetts Institute of Technology police officer in an eruption of gunfire at the prestigious university, Boston television stations reported.

The university said the situation was "extremely dangerous" and warned students in an emergency alert on its website to stay indoors, adding that one building on campus had been surrounded by police.

The Massachusetts district attorney's office confirmed the killing and said it was investigating, the AFP news agency reported.

MIT is in the suburbs of Boston, where two bombs at the city's marathon on Monday killed three people and injured 180. However, no link between the two incidents has been immediately established

The university alert said the gunshots started at 10:48pm (0248 GMT) and that the building where the shots were fired had been "surrounded by responding agencies."

"The area is cordoned off. Please stay clear of area until further notice," added the alert.

There was a major police presence in the district including officers with rifles and a search helicopter overhead, according to news reports.