Updated

A suspected extremist being held at a police station in western Kenya grabbed a gun and shot at police officers, killing four, leading to a hostage situation, an official said Thursday.

Police commandos have been deployed to rescue other prisoners at the station and try to end the standoff, Kenya's police chief, Joseph Boinnet, said.

"His attempts to escape were thwarted by quick arrival by other officers," Boinnet said.

An Associated Press reporter at the scene said gunshots could be heard after police commandos went into the building, and two nearby schools have been closed and the children evacuated.

The station commander was among those killed, West Pokot County Commissioner Wilson Wanyanga said.

Kenya has been trying to contain growing extremism influenced by the Al Qaeda-linked al-Shabab group based in neighboring Somalia. The Islamic State group has also emerged as a threat after authorities said tens of Kenyan youth were being recruited by the group.

Al-Shabab has carried out numerous attacks in Kenya since 2011, saying it is responding to the deployment of Kenyan troops in Somalia to fight the extremists.

Boinnet said that earlier on Thursday, al-Shabab members attacked a police station in Kenya's coastal region but were repulsed. One suspected militant was killed in the attack, he said.