When you think law enforcement, do you ever think correctional officer? NO? You should. It's different from being a police officer, but they are still also involved in the same line of work.
They too have the task of enforcing laws and making sure that order is maintained. Except they have to do it in a prison system, surrounded by convicts.
Let's take a look at what happens within the criminal justice system. Actually, let's just condense it for the sake of ease...
Someone out in the public breaks a law. They are caught by the police and arrested. They are charged, found guilty during a trial, and if serious enough, they are sent to prison.
Enter: the prison guard AKA correctional officer.
They have the task of maintaining order inside the prison. Except one difference is that EVERYONE in the prison that they have to watch or interact with are all convicted violent criminals. (well, maybe not ALL are violent, but they are still criminals who have broken the law)
In other words, the same criminal that the police officer arrested out in the street must now be dealt with by the CO.
Typically the CO's (or prison guards) are outnumbered in the prison. After all, there will always be more convicts inside the prison then there are guards. It's an unnerving feeling to be trapped inside the same structure and walls as the criminals that are being kept their for punishment.
And if things go badly, it can be really dangerous. Check out the following video from a riot that erupted in the yard at Pelican Bay:
Another video from a prison shows a riot on the inside and what they have to deal with when trying to get in and re-take areas that have been lost to the convicts:
As you can tell, it can be a dangerous situation. It's a job that requires dedication, discipline and cool, level head.