LONDON (Reuters) - For Prince Harry it was the perfect image makeover.
One minute, the third in line to the throne was pilloried as a playboy prince who clashed with paparazzi outside nightclubs and wore a Nazi uniform at a costume party.
The next minute, the flame-haired 23-year-old is the soldier hero, hailed for his 10 weeks on the frontline fighting the Taliban in Afghanistan.
In Afghanistan, the Queen's grandson may have bemoaned media intrusion.
But back home, the same tabloids who had berated him -- and agreed to maintain a news blackout about his presence in Afghanistan until foreign media broke the embargo -- were fulsome in praise of "Harry The Secret Hero."
"When Harry met Tali," trumpeted the Daily Star tabloid as the prince headed home, his tour of duty cut short amid security fears about his safety and that of the soldiers serving with him.
For royal palace minders ever mindful of the prince's once tarnished image, this was priceless publicity.
The prince had gained a reputation as a "wild child" by dabbling in marijuana and under-age drinking as a 17-year-old.
Many royal watchers believe Harry suffered more than his elder brother William after Diana died in a car crash in 1997, pursued by paparazzi into a Paris road tunnel as they clamoured for yet another shot of the world's most photographed woman.
Harry was just 12, and the sight of him at the funeral -- a forlorn boy, head bowed as he walked behind Diana's cortege -- was unforgettable.
Some commentators said it was Diana's death which prompted Harry to dabble with soft drugs five years later.
He admitted smoking cannabis and getting drunk in a pub near the royal family's country estate and locals said he had fallen in with a bad crowd.
In response, his father sent him to a drug rehabilitation clinic in London for a day to give him a glimpse of the dangers of drug abuse.
His on-off relationship with girlfriend Chelsea Davy was also the perfect fodder for royalty-obsessed tabloids.
But his army career has turned the "bad boy" image around.
First came the disappointment of losing out on deployment to Iraq after militants threatened to kill or kidnap him. He admitted that blow made him contemplate leaving the army.
But then came the calculated gamble to seek media collusion in his covert deployment to Afghanistan. The blackout lasted 10 weeks -- much longer than many commentators would ever have expected in the cut-throat world of the British media.
And then suddenly all the TV soundbites -- one channel even asked Muslims outside a London Mosque at Friday prayers what they thought of Harry's deployment -- were fulsome in praise and generals were already saying that maybe he could return on another deployment to Afghanistan.