ST. JOSEPH, Mich. - A jail inmate trying to escape from a western Michigan courthouse wrested a gun from an officer Monday, killing two bailiffs and injuring two more people before he was fatally shot by other officers, a sheriff said.

People inside the building scrambled for cover at the Berrien County Courthouse in St. Joseph in the southwestern corner of Michigan, about 100 miles northeast of Chicago.

"Our hearts are torn apart. ... I have known them for over 30 years. It's a sad day," Sheriff Paul Bailey said of the bailiffs.

The inmate, locked up on several charges, was being moved from a cell for a courtroom appearance when a fight occurred and he was able to disarm an officer, Bailey said. The sheriff did not say what charges the inmate was facing.

He shot a sheriff's deputy, killed the bailiffs and then shot a civilian in the arm in a public area, the sheriff said.

The inmate then was fatally shot "by two other bailiffs who came to render aid, along with several other officers," Bailey said.

"He was trying to escape," the sheriff said.

The injured suffered by the deputy and the civilian aren't considered life-threatening.

Authorities had not yet released the names of anyone involved. Bailey also said Monday evening that he didn't yet have all of the details on the shooting, including whether the inmate was handcuffed at the time.

Appearing with Bailey and other law enforcers, Gov. Rick Snyder called it a "terrible day in a wonderful community."