By Justin Madden and Fiona Ortiz

(Reuters) - Two bailiffs were shot dead during a scuffle with a prisoner turned gunman inside a southwest Michigan courthouse on Monday that also wounded two people before police officers killed the shooter, a county sheriff said.

Larry Darnell Gordon, 44, fatally shot bailiffs identified as Joseph Zangaro, a retired Michigan state police lieutenant, and Ron Kienzle, a retired Benton Township police sergeant, the Detroit Free Press newspaper reported.

The shootings of the bailiffs and the deputy came four days after four Dallas police officers and a Dallas transit police officer were killed by a sniper who claimed to be motivated by the use of lethal force by police against African-Americans.

Berrien County Sheriff Paul Bailey told a news conference that the shooting took place at about 2:25 p.m. local time on the third floor of the St. Joseph, Michigan, courthouse.

Bailey said Gordon was a prisoner who took a gun from one of two bailiffs escorting him to a courtroom and then began shooting as he tried to escape from custody. A sheriff's deputy and civilian were also wounded, he said.

"Our hearts are torn apart. They were our friends," Bailey told reporters. "It's a sad day."

Bailey said the deputy and civilian who were shot were taken to hospital and were expected to survive.

The suspect was shot and killed by police officers, he said.

Chris Gautz, public information officer for the Michigan Department of Corrections, said on Twitter all Department of Corrections staff were safe and accounted for.

A witness, Gretta Volkenstein, told CNN that buildings and government agencies in the area were placed on lockdown as the incident unfolded.

It was not immediately known why the prisoner was being escorted to the courtroom but Bailey said that was being investigated.

"MSP (Michigan State Police) has secured the scene at the Berrien County courthouse and started its investigation into the shooting that occurred this afternoon," Governor Rick Snyder said on Twitter.

Bailey said the courthouse would be closed on Tuesday.

St. Joseph is a town in southwest Michigan, across Lake Michigan from Chicago.

(Reporting by Justin Madden and Fiona Ortiz in Chicago; Additional reporting by Eric Beech in Washington and Brendan O'Brien in Milwaukee; Writing by Fiona Ortiz; Editing by James Dalgleish, G Crosse and Paul Tait)