LONDON, England (CNN) -- Prince Harry has been withdrawn from Afghanistan because of the media's disclosure of his deployment there, the British Ministry of Defense said Friday.
Prince Harry's tour of duty in Afghanistan has ended following media reports of his deployment.
The prince had been deployed to Afghanistan since December. Major news outlets agreed to keep the information secret for security reasons, but a Web site broke the news blackout Thursday, prompting the British military to withdraw the prince for security reasons.
"This decision has been taken primarily on the basis that the worldwide media coverage of Prince Harry in Afghanistan could impact on the security of those who are deployed there, as well as the risks to him as an individual soldier," the Ministry of Defense said in a statement issued Friday.
The ministry termed "regrettable" the decision of "elements of the foreign media" to reveal Prince Harry's service in Afghanistan.
"Whilst it had been intended that Prince Harry should return in a matter of weeks with the remainder of the Household Cavalry Regiment Battlegroup," the ministry said, "the situation has now clearly changed." Watch Prince Harry head home »
The British Ministry of Defense confirmed to CNN that Harry was en route late Friday from Afghanistan to Great Britain.
Gen. Richard Dannatt, the chief of Britain's General Staff, said in a statement released Thursday that he judged it safe to send the prince to Afghanistan -- so long as the media didn't reveal his location.
"I am very disappointed that foreign Web sites have decided to run this story without consulting us," Dannatt said. "It was my judgment that with an understanding with the media not to broadcast his whereabouts, the risk in (deploying him to Afghanistan) was manageable."
British Defense Secretary Des Browne said Friday that Prince Harry was able to deploy to Afghanistan only "because of the cooperation of the media, who exercised a degree of discipline and I think that they should be commended for the fact that they have allowed him that space and time so we could manage the risks associated with that." Watch the prince's redeeming tour of duty »
He added, "It is disappointing that the story has broken in the way in which it did."
Withdrawing Prince Harry from Afghanistan was "a decision that has been made by the defense staff, and I think everybody will respect that to be the right decision," British Prime Minister Gordon Brown said Friday. "What matters is the safety of Prince Harry."
He added, "I think the whole country owes Prince Harry a debt of gratitude for his service, his courage, his bravery, under the most difficult of circumstances in Afghanistan."
The 23-year-old prince holds the rank of cornet -- equivalent to a second lieutenant -- and serves as a forward air controller with a group called Joint Tactical Air Control, or JTAC.
"At the end of the day I like to sort of be a normal person, and for once I think this is about as normal as I'm ever going to get," he said in a recent interview. "As far as I'm concerned, I'm out here as a normal JTAC on the ground and not as Prince Harry."
Watch reaction to Prince Harry's withdrawal »
Queen Elizabeth II, who was visiting an elderly care home in Windsor on Friday, acknowledged a resident's compliment of her grandson.
"Can I say to you, ma'am, I'm very proud of Harry, Prince Harry, of the job he's doing," said the man, a former soldier who was not identified.
Because of the unique circumstances of the deployment, CNN, as well as other news organizations, chose to honor an embargo requested by the military.
His duties included calling in airstrikes and air support when necessary, guaranteeing the accuracy of bombing on the ground and guarding against incidents of friendly fire.
Prince Harry is the younger son of Prince Charles, the heir to the British throne, and the late Princess Diana, who died in a Paris car crash in 1997.
Last year, the military ruled he could not be sent to Iraq because publicity about the deployment could put him and his unit at risk.
But Dannatt said the experience has demonstrated "that it is perfectly possible for Prince Harry to be employed just the same as other Army officers of his rank and experience."
"His conduct on operations in Afghanistan has been exemplary," the general said. "He has been fully involved in operations and has run the same risks as everyone else in his battle group. In common with all of his generation in the army today, he is a credit to the nation."
Shortly after the news of the prince's deployment broke, several Islamist Web sites posted messages alerting their "brethren" in Afghanistan to be on the lookout for the royal soldier.
"O brothers of monotheism, if you find anyone with unusual security in his battalion, know that this could be the Prince Harry. We ask God that he gets caught on your hands," one such posting read.
Several members of the British royal family saw combat in the past century. Prince Harry's grandfather, Prince Phillip, served aboard warships in World War II; his great-grandfather -- the future King George VI -- took part in the World War I naval battle of Jutland; and Prince Andrew, Prince Harry's uncle, flew Navy helicopters during Britain's 1982 war with Argentina over the Falkland Islands.
Prince Harry's brother, Prince William, is also an army officer. But as second in line for the throne, he is specifically barred from combat.
The last sitting British monarch to lead troops in battle was George II, who defeated a French force at the Battle of Dettingen in 1743. E-mail to a friend