PARIS—A police sharpshooter accidentally fired his weapon during a speech by French President François Hollande and two people were slightly injured, the top official of France’s Charente region said Tuesday.

Pierre N’Gahane said the incident occurred while Hollande was inaugurating a new fast train line in the western town of Villognon.

The regional prefect, speaking to journalists near the scene of the incident, said the gendarme, or military police officer, was located on a high spot, “his regular position,” when his weapon was fired.

Asked if the sharpshooter fired accidentally, N’Gahane responded: “Yes, without doubt.”

He said two people were slightly wounded, each in one leg. “We were able to discuss with them immediately afterward,” he said.

On a video of Hollande’s speech posted on the Twitter account of the Elysée Palace, Hollande is seen speaking on a platform in front of an audience when suddenly a sound resembling a shot is heard.

Hollande briefly stopped speaking, looked in the direction of the noise and quietly said he hoped it was nothing serious, then that he didn’t think it was, and resumed his speech.

The incident occurred shortly before the end of the 20-minute speech. His speech was interrupted for less than 20 seconds.

N’Gahane said a judicial probe has been launched under the supervision of the local prosecutor. An administrative inquiry will also be carried out, and the gendarme will have to give an account of what happened, he said.