A gunman has shot dead 12 people at a top training institute in Azerbaijan's capital, Baku, before turning the gun on himself, officials say.
Another 13 people, among them foreigners, were wounded in the attack at the elite State Oil Academy.
The gunman was later identified as Farda Gadirov, 29, a Georgian national of Azeri origin. The motive for the shooting was not immediately known.
The academy building in central Baku was secured after a police operation.
Pools of blood
The gunman opened fire shortly after classes at the academy began at 0900 local time (0400 GMT).
We were in an exam, we heard gunshots, we went out of the classroom in panic and saw a gunman opening fire on everyone
Bekir Belek, Turkish student
The attacker had entered the academy and "shot at everyone he saw", while moving from the first to the sixth floor of the building, the Azeri interior ministry said in a statement.
It said he was using a Russian-made Makarov pistol and had three ammunition belts.
"The police arrived at the scene and when he [the attacker] realised that he could not escape from the building he shot himself," the statement added.
Sudanese and Syrian nationals were reportedly among the wounded.
Witnesses said the attacker fired at random as he made his way through the building.
"We were in an exam, we heard gunshots, we went out of the classroom in panic and saw a gunman opening fire on everyone," Bekir Belek, a Turkish student, told Turkey's CNN-Turk television channel from a hospital in Baku.
Local television footage from inside the building showed bodies lying face-down in pools of blood.
Earlier media reports said there were at least two gunmen.
Azeri President Ilham Aliyev expressed his condolences, saying he would personally oversee the investigation.
Azerbaijan is rich in oil and its state oil academy was founded in 1920.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.