The shooting took place just before noon on Tuesday in Whitecourt, where two local men were making their first court appearance after a drug bust last week.
An eyewitness said the disturbance began with what sounded like a fight in a hallway used to transport prisoners.
"You could hear behind the door where they keep prisoners to stand trial, you could hear there was a fight happening between whomever," said Kathlene Campbell-Conlon, a reporter for radio station CFXW, who was in court to cover the appearances.
"An officer who was in the court at the time hopped the guardrail and ran behind the door," she said. "The door shut, you heard more fights, you heard a couple of high-pitched screams, then two, maybe three gunshots."
The impact of the shots, she said, knocked hangings off the wall inside the court. The immediate reaction among those in the room was panic. Everyone was pushing to get out and chairs were being thrown around, said Campbell-Conlon.
Once outside, she said bystanders tried to get help for the wounded officer.
"You (could) hear people saying, 'You have to call 911! We have to get an ambulance! This officer needs medical attention!' "
Then she watched the suspects flee.
"As I walked toward the sounds of everything that's happening, I saw a man climb into the passenger side of this sheriff's van.
"You could hear people: 'There's a prisoner in there!' We're yelling this. Then they backed out and they drove south out of Whitecourt."
Mayor Trevor Thain confirmed the prisoners escaped in the sheriff's van. Thain said the two escapees were arrested at a farmhouse about 10 kilometres south of Whitecourt.
Thain said police detained a third man at the farmhouse.
"There's a third man taken into custody, but we don't know if he's a suspect," he said.
Staff Sgt. Rodney Koscielny said officers arrived to find the van taken by the prisoners had become stuck in deep snow on the rural property.
``From what we can tell, there may have been shots fired at this location," he said.
"This is over the top, right? We're here to protect the public and something like that affects us all, including the public. So yes, it is very serious."
The sheriff, who RCMP say was part of the prisoner transport section, was taken to hospital. Officials with the union representing the sheriffs said he will recover.
“I am relieved to hear reports that the provincial sheriff who was shot at work in Whitecourt will recover from his injury,” said President Guy Smith of the Alberta Union of Provincial Employees.
Union Local 003 Chair Clarke McChesney said the officer, whose name has not been released, will be able to return to work.
"No gunshot wound is trivial, but the outcome in this case could have been much worse," said McChesney. "I am glad to know this member will be able to go home and come back to work again."
Alberta's sheriffs are armed law enforcement officers who come under the province's Solicitor General. They support RCMP and municipal police officers in a variety of roles, including courthouse security and prisoner management and transportation.
Thain says the suspects were among those arrested in last week's drug bust. Six people were charged after that raid, which turned up cocaine, methamphetamine and marijuana, as well as an illegal firearm.
Justice officials said the amounts of the drugs seized in the raid were small.
Also on HuffPost