Tens of thousands of people had paid their last respects at the ancient church on the Royal Mile, with demand so high the queue had to be closed after noon.
Meanwhile, people packed into the historic streets of Edinburgh for the third consecutive day to see the coffin leave the cathedral.
Carried out of the church to the sound of a lone piper, the hearse carrying the Queen’s coffin then departed for Edinburgh Airport.
As it did, the crowd, who had gathered in numbers in the late afternoon sunshine, burst into applause.
Take a look through our picture gallery below.
. Collage Maker-13-Sep-2022-06.19-PM.jpg
Applause rang out in the heart of Edinburgh as the Queen left the Scottish capital for the final time. Photo: PA
. Pallbearers carry the coffin
Pallbearers carry the coffin of Queen Elizabeth II from St Giles' Cathedral, Edinburgh after a prayer service. Photo: Carl Recine
. Queen Elizabeth II departs
The hearse carrying the coffin of Queen Elizabeth II departs St Giles' Cathedral, for Edinburgh Airport, where it was flown by the Royal Air Force to RAF Northolt. Photo: Lisa Ferguson/The Scotsman Photo: Lisa Ferguson/The Scotsman
1. Pallbearers carry the coffin
Pallbearers carry the coffin of Queen Elizabeth II from St Giles' Cathedral, Edinburgh after a prayer service. Photo: Carl Recine
2. Queen Elizabeth II departs
The hearse carrying the coffin of Queen Elizabeth II departs St Giles' Cathedral, for Edinburgh Airport, where it was flown by the Royal Air Force to RAF Northolt. Photo: Lisa Ferguson/The Scotsman Photo: Lisa Ferguson/The Scotsman
3. The coffin of Queen Elizabeth II
The coffin of Queen Elizabeth II at Edinburgh Airport from where it was flown by the RAF on its journey from Edinburgh to Buckingham Palace, London, to lie at rest. Photo: Andrew Milligan
4. Royal Archers
Royal Archers salute the coffin of Queen Elizabeth II as it departs St Giles' Cathedral, Edinburgh, after a prayer service. Photo: Kai Pfaffenbach