Queen Elizabeth joined army top brass and relatives of British soldiers who died in Afghanistan at a commemoration service at St Paul's Cathedral in London on Friday, marking the end of 13 years of British military operations in the country.
Also among the congregation was Tony Blair, who as prime minister in 2001 took Britain into the US-led coalition that invaded Afghanistan and toppled the Taliban government in response to the September 11 attacks on New York and Washington.
Britain lost 453 servicemen and women in Afghanistan out of the 140,000 who served there over the years. The last combat troops left in October last year, leaving behind only about 500 trainers and advisers assisting the Afghan security forces.
The government says the long war stopped Afghanistan from being used as a safe haven for militants to plan attacks on British streets, and that Afghanistan is now a safer and more prosperous country than it was before.
However, the war remains controversial in the eyes of some Britons, who say its objectives were not articulated clearly enough and Britain paid too high a price for what was achieved.
No hint of that was apparent during the service at St Paul's, which was attended not only by the queen but also by most senior members of her family including her grandson Prince Harry, who served two tours of duty in Afghanistan.
Also present was Prime Minister David Cameron, and among those who read prayers was Kerry Ashworth, whose son James died in battle in Afghanistan in 2012 and was posthumously awarded the Victoria Cross, Britain's highest military honor for bravery which is rarely bestowed.
During the service, the Archbishop of Canterbury, spiritual head of the Church of England, blessed a cross made of shell casings that previously adorned a memorial wall at Camp Bastion, the main hub of the British military in Afghanistan.
David Coulter, a chaplain who spent time at Camp Bastion during the war, recalled memorial services that took place there before the cross, which was made by a group of soldiers.
"Services at this memorial were always poignant, tender and raw. In those moments, in the silence and the words, God was present and troubled hearts wrestled with questions with no easy answers," he said.
The service was followed by a military parade through the City of London and a flypast of aircraft used in the campaign, including Chinook, Apache and Sea King helicopters and Hercules and Tornado airplanes.