People scrambled for cover inside 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 injuries suffered by the deputy and the civilian weren't considered life-threatening.
The names of the three dead won't be released until relatives have been notified. Bailey also told reporters that he didn't yet have certain details on the shooting, including whether the inmate was handcuffed at the time.
Gov. Rick Snyder cut short a visit to Midland and traveled across the state to St. Joseph to meet with investigators and victims' families.
Snyder called it a "terrible day in a wonderful community."
MSP has secured the scene at the Berrien County courthouse and started its investigation into the shooting that occurred this afternoon.— Governor Rick Snyder (@onetoughnerd) July 11, 2016
Please join me in praying for those affected. We will share more information here from MSP as it becomes available.— Governor Rick Snyder (@onetoughnerd) July 11, 2016