Mourners of all ages and faiths attended the short graveside service at Seafield Crematorium and Cemetery in Edinburgh yesterday.
The funeral was held just around the corner from the site where a dog walker found the lifeless infant wrapped in a blanket in July 2013.
Despite extensive police investigations, DNA tests and public appeals, the baby boy and his family were never identified.
Around 250 people gathered to watch the tiny white coffin being carried to the graveside, led by a lone piper playing Amazing Grace.
Reverend Erica Wishart said the baby’s death was the “kind of tragedy that surely touches everyone”.
She said: “This tiny baby is never going to have the chance to grow up and live his life. We are here to say goodbye to this wee one, with the dignity and respect that he deserves. We are here to mourn a life that could have been.”
People were visibly upset as the coffin was lowered into the ground to a lament from the piper, before it was decorated with soft toys and white rose petals. Dozens of flowers, teddies and cards were left on the grave, bearing emotional tributes including, “The people of Leith are your family now”, and “Twinkle, twinkle, little star, how we wonder who you are”.
Mourners said they felt compelled to attend the funeral to ensure the unknown little boy was not buried alone. Gillian Henderson and Ros Lowrie, befrienders at child bereavement charity Sands Lothian, said the turn-out was “just amazing”.
Ms Henderson, a bereaved parent herself, said: “He has touched so many people’s hearts. A lot of people have felt the need to come here and show their respects for him.”
Dee Urquhart, who had travelled to Leith from her home in Bonnybridge, said: “I saw hundreds of people here leaving all the flowers and soft toys. It’s nice to see that there’s so many caring people out there.”
A convoy of motorcyclists from the Riders Branch of the Royal British Legion Scotland were among those paying their respects.
Colin MacNab, 54, a serving army officer and chairman of the branch, said: “We felt obliged to come along and say farewell to the wee man. We have got members from all over Scotland who are praying. We just wanted to pay our respects.”
He added: “There’s obviously a mother out there who needs help.”
Kelly Roberts, 26, of Bonny-rigg, took the day off work so she could attend the service.
She said: “I remember when it happened. I hope the mum gets the help she needs – she obviously needs support. I think the turnout is amazing, it’s brilliant to see. This wee boy, he never had anybody in his last minutes, and now he has.”
Imam Sajjad, of Craigmillar Islamic Centre, joined other members of Edinburgh Interfaith Association to represent the capital’s different communities.
He said: “It’s a great honour for all of us to be here to pay tribute to this innocent soul.”
After the harrowing discovery in the summer of 2013, tests on the baby showed that he may have been up to six weeks old, and appeared to have been healthy and well fed up until his death.
Police were inundated with offers of help when they announced plans for the funeral last week. The child was laid to rest in a gown made by retired dressmaker Margaret Halliday, while piper Cameron McKay, 21, played the lament.