LOCKPORT – Former Somerset Town Justice Jeffery P. Wick was placed on three years’ probation and assigned to Niagara Falls Mental Health Court on Wednesday for an incident in which his teenage son prevented a potential car crash.

Wick, 39, of Shenk Road, Sanborn, had pleaded guilty to endangering the welfare of a child and second-degree criminal contempt.

Wick, who was sitting in the passenger seat, was charged with pressing his foot down on the accelerator while his son was driving June 12 on Route 31 in Cambria. The 16-year-old slammed the transmission into park to prevent a possible high-speed crash, state police said. Wick also admitted violating a restraining order obtained against him by his ex-wife.

Niagara County Judge Sara Sheldon Farkas could have sent Wick to jail for two years, but she opted for court-supervised treatment.

Wick said that on June 12, “I didn’t know what was going on. I wasn’t medicated properly.” He blamed advice from a doctor.

He was diagnosed with bipolar disorder the day of the incident, but Assistant District Attorney Lisa M. Baehre said, “He has to start accepting responsibility for his actions and not hide behind his mental health issues.”

Wick served 116 days in County Jail awaiting a plea deal in the case. Baehre said she promised Wick’s son to ask for probation and mental health court as a sentence for his father.

Wick was elected town justice in Somerset in 2003 but stepped down in 2006 after pleading guilty to harassing his wife.

Farkas told Wick that failing to take his medication would be a violation of probation. She also barred contact with Wick’s ex-wife, but not with his son.