A county corrections officer was shot and wounded Monday night by another officer in a vehicle parked outside the Maine Criminal Justice Academy in Vassalboro, authorities said.

Maine State Police are investigating what was described as an accidental shooting of Matthew Morrison, 33, of Mars Hill, according to a news release Tuesday from Steve McCausland, spokesman for the state Department of Public Safety.

Morrison, an Aroostook County corrections officer who suffered a gunshot wound to the leg, was flown by LifeFlight helicopter to Maine Medical Center in Portland, where he was expected to undergo surgery today.

The shooting happened about 8 p.m. Monday as three men — Morrison, as well as Cumberland County corrections officers Matthew Benger, 24, of Portland, and Cody Gillis, 25, of Brunswick — were leaving the academy grounds for the evening. The three men were attending a five-week basic corrections training program at the academy and the truck was in the rear parking lot of the police academy complex, located off Oak Grove Road, McCausland said.

A 9 mm handgun owned by Gillis was stored in the console of his truck. Benger, a Cumberland County corrections officer who was a front seat passenger, was handling the gun when it fired as Morrison was sitting in the rear seat of the truck and Gillis was in the driver’s seat, according to McCausland.

Morrison initially was taken by ambulance to MaineGeneral Medical Center in Augusta and then flown by the Lifeflight helicopter to Maine Medical Center in Portland.

John Rogers, the academy’s director, said the three officers were in the fourth week of their correctional training, which takes place during the day, according to McCausland. The class involved 29 correctional officers from the county jails and the Maine correctional system, he said, adding that some officers commute from home and others stay at the academy during the week.

“The three officers involved in the incident were staying at the academy and were leaving the campus last night on an errand,” McCausland said in the release. “Rogers said he will review the incident and is awaiting the final investigative report from State Police. The Kennebec County District Attorney’s Office will also be receiving a copy of that report.”