A Chinese student allegedly tried to smuggle a knife into Buckingham Palace in his shoe and said he wanted to kill the Queen, a court has heard.

Hang Zhang, 25, who is a University of Sheffield student, was arrested at Her Majesty's London home on Friday - the fourth security alert there in three months.

Zhang, who told police he he feared Chinese government agents were following him, had a charge of threatening to kill the Queen dropped because of his mental health.

But he still appeared at Westminster Magistrates' Court yesterday accused of possessing an offensive weapon.

In the dock: Hang Zhang, 25, is accused of trying to break in to Buckingham Palace last Friday allegedly with a knife hidden in his shoe

Breach: Her Majesty, pictured in Scotland last month, has suffered four security alerts in three months - last week John Bolton, 47, right, pleaded guilty to possession of the three lock knives

His attempt to sneak into the Palace is the fourth security alert there since May. The Queen is not believed to have been at home.

Last week a drunk man scaled a fence and spent 14 minutes prowling the grounds.

The unnamed suspect from Croydon breached the outer perimeter of the palace at 4.15am by climbing a fence with motion sensors and security wire.

Denis Hennessy, a convicted murderer, got into the grounds of Buckingham Palace in May and was jailed for four months

He spent 14 minutes wandering around the gardens before being arrested by royal protection officers who spotted him on CCTV.

A Royal fanatic caught outside Buckingham Palace armed with three knives days before the Queen's birthday will be sentenced later this month.

6ft 9ins John Bolton, 47, pleaded guilty to possession of the three lock knives while parked in his car, 100 metres away from the palace on June 9, this year.

Police officers found Bolton under Wellington Arch wearing an army beret with an SAS badge.

He told them he was working for the Queen and Prince Philip and was in the area for five days as a guard.

In May an intruder who sparked a police lock-down at Buckingham Palace when he scaled a 10ft wall was revealed as a convicted murderer.

Denis Hennessy, 41, wandered through the royal gardens for up to ten minutes, before asking armed officers, ‘Is Ma’am in?’

The unemployed Irishman was oblivious to the security alert he had caused as the Queen, Duke of Edinburgh and Duke of York were rushed to safety.

After the drunken trespasser was confronted just 50 yards from the palace, investigators were shocked to discover his past conviction – which saw him jailed for life at the age of 18.

He had bludgeoned homeless man Kevin Cusack to death with a 10in iron bar outside a north London fish and chip shop, in an attack compared to scenes from the ultra-violent film A Clockwork Orange.

After breaking into the Palace he was jailed for four months.