London: Prince William brought back the body of a soldier killed in action during his secret mission to Afghanistan, it was revealed.

William, 25, who recently qualified as an RAF pilot, took the controls of a C-17 Globemaster transport plane for part of the journey.

He flew in to war-torn Kandahar on Sunday and returned home on Monday, bringing with him the body of 22-year-old Robert Pearson of the Queen's Royal Lancers.

William consoled Pearson's family when the plane landed at RAF Lynam. The prince was said to be "honoured" by the opportunity to pay his respects to the relatives in person.

A Clarence House spokesman said: "It wasn't planned. It just happened that this was a repatriation flight. On landing, he had a few words with Robert Pearson's family in a private room."

Trooper Pearson's commanding officer, Lieutenant Colonel Richard Nixon-Eckersall, said: "For those that might question whether or not today's soldiers are a match for their forebears, he was ample proof that they are every bit as good and more."

William's trip to Afghanistan was his last chance to take part in an operation before leaving the RAF where he is known as Flying Officer Wales. He has been on attachment from the Army where he is a second lieutenant.

The prince flew out of RAF Brize Norton, in Oxfordshire, with two co-pilots. He spent three hours with UK service personnel at Kandahar airfield during the 30-hour mission.

A Clarence House spokesman said the Prince of Wales and the Queen had given their permission for the trip.

An aide said: "There won't be any activity after this. He'll probably have some drinks with the boys on Friday to say goodbye. But in terms of flight operations, this was his last chance. William is determined to do a proper job like his fellow officers. His view is if he is in the armed services he has to step up to the table."

After leaving Afghanistan, William, who is second in line to the throne, flew on to Al Udeid air base in Qatar where he spent the night.