Three police officers were killed and two others critically injured in a shooting in the US state of Pennsylvania, while following up on a domestic-related investigation, authorities have said.

Pennsylvania State Police Commissioner Colonel Christopher Paris stated that the gunman was fatally shot by law enforcement officers.

The incident occurred just after 2:00 PM local time (6:00 PM GMT). Images from the scene depicted an officer being airlifted by helicopter.

The shooting prompted the nearby Spring Grove school district to shelter in place, although the school reported that it was not directly affected.

There was no active threat to the public following the incident, according to officials.

The incident took place in a rural area of York County in North Codorus Township, approximately 100 miles (160 km) east of Philadelphia, as the officers were conducting an investigation initiated the previous day.

Many details remain undisclosed as the investigation continues, remarked Commissioner Paris.

Pennsylvania Governor Josh Shapiro visited the area and connected with the families of the fallen officers, expressing grief for the loss of lives and condemning the violence. This kind of violence is not OK, we need to do better as a society, he stated.

In honor of the deceased officers, Shapiro ordered all state flags to be flown at half-mast across Pennsylvania.

FBI Director Kash Patel announced that agents were on-site, offering help to local and state authorities. Our prayers are with the officers, their families, and the entire York County community, Patel said in a statement.