uk – Can an EU citizen be prevented from entering another member state?

This doesn’t apply to any real scenario but it’s just a hypothetical. I was watching a border security show (UK Border Force) and in one episode a Polish gentleman who had a criminal record for petty theft and was a suspect in an armed robbery of a jeweler store was not allowed entry into the UK as he was believed to pose a danger to public security.

I would have believed that EU citizens are entitled to live/work in other member states (even with a criminal record) as it’s part of the four freedoms but I’ve heard that an exception can apply if an immigration officer believes they will engage in serious criminal activity during their stay. What is the truth in this?