A police officer tasked with protecting a private school for girls in northwestern Pakistan on Tuesday opened fire at a school bus carrying teachers and students, killing an 8-year-old girl and injuring five others, officials said.

The shooting happened in the Swat Valley in Khyber Pakhtunkhwa province. Senior police official Nasir Satti said officer Alam Khan was immediately arrested. He said the shooting was not a militant attack.

TRIBES FEUDING OVER COAL MINE OWNERSHIP KILL 15 IN REMOTE NORTHWEST REGION

Satti said officers were questioning Khan to determine what prompted him to fire at the bus as it was leaving the school that serves girls up to age 17. He said four students and a woman who was on the bus were injured in the shooting.

Pakistan Flag

A Pakistani police officer has been arrested for shooting up a bus at a girls' school he was tasked with guarding. (ARIF ALI/AFP via Getty Images)

Satti said Khan was on security duty at the school because of concerns of possible militant attacks.

US EMBASSY IN PAKISTAN ISSUES SECURITY ALERT AMID VIOLENT CLASHES WITH PROTESTERS OVER IMRAN KHAN ARREST

The Swat Valley was the stronghold of the Pakistani Taliban, formally called the Tehreek-e-Taliban Pakistan, until 2019 when security forces cleared the region of militants after military operations.

Gun violence targeting children is rare in Pakistan. However, nearly 150 people, mostly students, were killed in 2014 when TTP militants attacked a school in Peshawar, the capital of Khyber Pakhtunkhwa. Since then, authorities have deployed police at schools across the country, especially in the volatile northwest where the Pakistani Taliban have stepped up attacks on security forces in recent months.

CLICK HERE TO GET THE FOX NEWS APP

The Pakistani Taliban are a separate group but also a close ally of the Afghan Taliban, who seized power in neighboring Afghanistan in August 2021 as U.S. and NATO troops were in the final stages of their pullout from the country after 20 years of war.