A man who opened fire at an oil training institute in Azerbaijan on Thursday killed 12 people and injured 13 before turning the gun on himself, officials said.

Police were not releasing details about the shooting at Baku's Azerbaijan State Oil Academy, which is recognized as a major international training centre for oil industry specialists.

But the country's Interior Ministry and state prosecutors released a joint statement on Thursday that said the suspect, Georgian citizen Farda Gadyrov, 29, entered the building, climbing five floors and shooting everyone he encountered.

Gadyrov then shot and killed himself with the gun, a semi-automatic Makarov pistol, when he saw police approaching, the statement said.

Thirteen people, including the gunmen, were killed in the incident and 13 were wounded, the Health Ministry said. Two foreign citizens from Syria and Sudan were among the dead, a police source told Reuters.

Government officials said they do not believe there was a political motive behind the attack.

Neither police nor the joint statement issued on Thursday speculated on a possible motive.

Witnesses said the gunman walked the hallways of the academy just after classes began at about 9 a.m. local time and aimed his gun at the heads of anyone within range.

"We were in an exam, we heard gunshots," Turkish student Bekir Belek told CNN-Turk. "We went out of the classroom in panic and saw a gunman opening fire on everyone. Three of my friends were shot."

Shooting causes chaos

There were conflicting witness reports in local media about the number of gunmen involved in the incident. But officials confirmed it was only one man.

Televised images showed students leaving the building and helping others who appeared to be injured. Other images showed victims lying face down inside the academy's corridors.

"There were bodies at each floor," said Ibrahim Kar, another Turkish student who was transferred to hospital.

Roads were closed in the area and special police forces were sent in to surround the building, the Interior Ministry said.

Azerbaijan is a mainly Muslim former Soviet republic with a population of about 8.3 million on the shores of the Caspian Sea, where it holds vast reserves of oil and gas.

"I feel deep regret, and consider this a terrible incident for our society," Education Minister Misir Mardanov told reporters.