BAKU (Reuters) -- A man was detained in Azerbaijan on May 1 in connection with the killing of 12 students and staff at Baku's prestigious Oil Academy by a gunman who then killed himself, the general prosecutor's office said.

"Nadir Aliyev was detained today in Baku as a suspect in this case," a spokesman for the prosecutor told Reuters. He said Aliyev was a friend of the attacker from the same region.

The spokesman gave no other details.

The gunman was identified as a 29-year-old Georgian citizen of Azeri origin, described as a loner by local media who had left his family in Russia to look for work in Baku.

Mourners laid flowers outside the university where the gunman struck after classes began on the morning of April 30, sending shockwaves through the mainly Muslim former Soviet republic, a supplier of oil and gas to Europe from the Caspian Sea.

Police and witnesses said he climbed from the first floor to the sixth shooting at anyone he met. Most of the victims were shot in the head.

Students who witnessed the rampage spoke of two attackers, but the Interior Ministry and general prosecutor in the tightly-run Caucasus state named only one.

There were also conflicting reports over the number of dead, with ANS television continuing to report on May 1 that 17 were killed. Thirteen were wounded and several were reported to be in critical condition.