During a day of riots he was seen hanging from a Union flag on the Cenotaph and leaping on to the bonnet of a Jaguar car that formed part of a royal convoy.

He was found on Friday to have also hurled a rubbish bin at the vehicle.

The court heard the Cambridge University student had turned to drink and drugs after being rejected by his biological father, the writer Heathcote Williams, and had taken LSD and valium in the hours leading up to the violence.

Gilmour's rock star father and mother Polly Samson watched from the public gallery as their 21-year-old son was told he must serve half the jail term behind bars.

Related Articles

Passing sentence at Kingston-upon-Thames Crown Court in Surrey, Judge Nicholas Price QC accepted that his antics at the Cenotaph on Whitehall did not form part of the violent disorder, but accused him of disrespect to the war dead.

"Such outrageous and deeply offensive behaviour gives a clear indication of how out of control you were that day," he said.

"It caused public outrage and understandably so."

His conduct at the war memorial had prompted a deluge of "vituperative and in many cases obscene" emails and other forms of communication, he told Gilmour.

These were, he added, "not just to you but, it is with deep regret, to your whole family, who were of course totally blameless."

Gilmour, who apologised afterwards for his behaviour, had claimed he had not realised the significance of the Cenotaph - an excuse the judge scoffed at.

"For a young man of your intelligence and education and background to profess to not know what the Cenotaph represents defies belief," he said.

"You have shown disrespect to those who gave the ultimate sacrifice, to those who fell defending this country."

Gilmour was part of a 100-strong mob that attacked a convoy escorting the Prince of Wales and the Duchess of Cornwall during last year’s student riots, the court heard on Thursday.

The Cambridge University undergraduate, who was also photographed swinging from a Union flag on the Cenotaph, leapt on the bonnet of a Jaguar carrying royal protection officers before allegedly throwing a bin at the vehicle.

Shouting slogans such as “you broke the moral law, we are going to break all the laws”, the 21-year-old son of the multi-millionaire pop star went on the rampage during a day of extreme violence in central London.

Video captured by police officers outside the Houses of Parliament showed Gilmour, from Billingshurst, West Sussex, waving a red flag and shouting political slogans. The judge watched one clip in which he was shouted: “Let them eat cake, let them eat cake, they say. We won’t eat cake, we will eat fire, ice and destruction, because we are angry, very f------ angry.”

As the clip was shown in court on Thursday, Gilmour sat in the dock giggling and covering his face with his hands in embarrassment.

On another occasion he could be seen urging the crowd to “storm Parliament” and shouting “arson”.

In addition to attacking the Royal cars, he was also part of a mob that smashed the windows at Oxford Street’s Top Shop as staff and customers cowered inside.

Gilmour, who was escorted into court by his father and his mother, Polly Samson, has already pleaded guilty to violent disorder and appeared at Kingston Crown Court for sentencing on Thursday.

The case was adjourned until today while Judge Nicholas Price QC decided whether Gilmour threw a bin at a car in the Royal convoy, which he had denied.

The judge was told that palace staff feared for the Royal couple’s safety when the convoy of three cars came under attack as the Prince and his wife made their way to the Royal Variety Performance at the London Palladium.

Royal protection officers and staff from the Royal household provided witness statements describing their fear as the cars were set upon by a baying crowd.

Sophie Densham, the private secretary to the Duchess of Cornwall, said she heard people shouting, “off with their heads”, “Tory scum” and “give us some money”.

Will Mackinlay, equerry to the Prince of Wales, described seeing a person with long hair, who was later identified as Gilmour, sitting on the bonnet of a Jaguar carrying royal protection officers, before watching someone hurl a bin at the car.

“I was very concerned for the safety of the convoy and the people travelling in the convoy. I was also concerned how the royal protection officers would react,” he said.

During the five-minute assault, the rear passenger window of the Royal vehicle was smashed, lime green paint was thrown over it and the Duchess was prodded in the side with a stick.

There is no evidence that Gilmour attacked the Rolls-Royce in which the Royal couple were travelling.

The student, who has just completed his second year studying history at Girton College, Cambridge, was among thousands of people who protested against plans to raise tuition fees.

The court heard that Gilmour had been identified at a number of flashpoints during the day, and was photographed attempting to set fire to a pile of newspapers outside the Supreme Court. A police officer stamped on the burning paper to put it out.

After being photographed swinging from the Cenotaph, he issued an apology describing it as his “moment of idiocy”.

In a statement, he said: “I feel nothing but shame. My intention was not to attack or defile the Cenotaph. Running along with a crowd of people who had just been violently repelled by the police, I got caught up in the spirit of the moment.”

Gilmour’s biological father is the poet and playwright Heathcote Williams but he was adopted by the pop star when his mother, a writer and journalist, remarried.