(AFP) – A man who scaled the walls of Buckingham Palace and got into the garden is a convicted murderer, a court heard Friday, as he was jailed for four months.

Dennis Hennessy, 41, repeatedly asked “is Ma’am in?” in an apparent reference to Queen Elizabeth II after being arrested by police on Wednesday night.

After climbing the wall, which was up to 10-feet (three-metres) high, and setting off an alarm, he spent around 10 minutes walking in the palace gardens, prosecutors at Westminster Magistrates’ Court said.

He later told police he had been “admiring the view”.

The queen, her husband Prince Philip and their son Prince Andrew were all at the palace when the incident happened.

Hennessy, of Wembley in northwest London, was imprisoned for the murder of a homeless man in 1992 but was out on licence, a legal term meaning he was still serving his sentence but allowed to live in the community rather than in prison.

During the hearing, he admitted one charge of trespass on a protected site and one of criminal damage.

District judge Howard Riddle sentenced him to four months for trespassing and two months for damaging the wires of the alarm system. The two terms will run concurrently.

It is relatively rare that intruders manage to breach security at Buckingham Palace.

In the most famous incident in 1982, Michael Fagan managed to get into the queen’s bedroom and spent 10 minutes talking to her before she could raise the alarm.