Schools in Benton and Fairfield were placed under lockdown Wednesday after a man shot himself to death in the parking lot of Benton Elementary School, the Kennebec County sheriff said.

School administrators saw an unfamiliar car in the parking lot and approached it, Sheriff Randall Liberty said. The administrators said it appeared that the man inside it was under the influence of an unknown substance and called Fairfield Rescue. When the rescue crew arrived, they began questioning the man, who suddenly retrieved a .38-caliber handgun from inside the car and fatally shot himself, Liberty said.

The man had no family members enrolled at the school and had no known connection to the school, police said.

“This incident appears to have randomly occurred at the Benton Elementary School,” Liberty said later Wednesday.

The first responders were unable to revive the man, identified as Anthony Harding, 41, of Dunbar Court in Waterville. Liberty said Harding was a suspect in a crime reported in Waterville earlier Wednesday. He said the man was holding a half-consumed bottle of Nyquil cough medicine and that several syringes and prescriptions were in the vehicle.

“No students, families or school staff were involved or in danger at anytime,” Dean Baker, superintendent of School Administrative District 49, said in a statement. Officials said school will be in session the remainder of the week. While no students or staff witnessed the incident, school officials said counselors will be available as needed.

Liberty said procedures in place at the school and in the law enforcement community worked as they were intended during the incident.

“During incidents such as these, it is obvious that the Benton Elementary School has prepared well to protect their students,” Liberty said. “The coordinated efforts of area law enforcement agencies and school officials have paid off. The response was rapid and all of our children are safe.”

The sheriff’s department was joined by Fairfield and state police and by Maine Forestry Service officers at the scene.