Prince Charles secretly ran a royal eye over his son’s student digs – to make sure Prince William is kept out of trouble.

William, who begins study at Scotland’s St. Andrews University in September, will lodge in a two-room apartment.

During a private, three-hour visit, Charles looked over the living space, which is flanked by single rooms where members of the Royal Protection Squad will be housed, according to The Sunday Mirror in London.

No effort is being spared to keep the handsome 18-year-old safe – the art-history department, where William will study, is being moved into the official residence of the university principal.

The school’s principal, Brian Laing, offered to move out to ensure William has maximum security.

“Prince Charles wanted a low-key visit,” a university source said. “He arrived by car with a small police escort and was swept straight up to the university. Most people didn’t even know he had been and gone.”