The sheriff, whose name wasn't released, was shot in the hand and was expected to recover, the Calgary Sun reported.
"News of today's shooting sent a chill up my spine," said Clarke McChesne of the Alberta Union of Provincial Employees.
"No gun shot wound is trivial, but the outcome in this case could have been much worse."
Johnna Ruocco, editor of the Whitecourt Star, said he was one of a couple of dozen people in a courtroom when the sheriff responded to a disturbance in a back room where prisoners were held. Several shots were heard and the courtroom emptied, he said.
"We heard the shots and everything froze and then we started running," Ruocco said.
"One of the crown prosecutors was yelling 'run, run!'"
The Sun said the gunman and the second inmate escaped in a sheriff's van shortly before noon, but were captured by Royal Canadian Mounted Police officers about 12:30 p.m. at a nearby home.
CTV News reported Whitecourt Mayor Trevor Thain said the suspects had been in court on drug charges.
Celebrity Families of 2014 [PHOTOS]