Accra, Ghana (CNN) -- Thousands of mourners gathered Friday in the West African nation of Ghana to pay their respects to the late President John Atta Mills, as his funeral was held in the capital, Accra.
Mills died last month at age 68, prompting outpourings of grief from many Ghanaians.
Ghanaians from all walks of life, many dressed in the traditional black and red of mourning, thronged Independence Square in Accra to witness the ceremony, in a show of national unity.
U.S. Secretary of State Hillary Clinton was among the many foreign dignitaries who traveled to Ghana for the funeral.
Ghana's Deputy Minister of Information Samuel Okudzeto-Ablakwa said 67 foreign delegations were represented from all over the world.
More than 15 heads of state, including almost all the West African leaders, attended the ceremony, which ended with the release of 100 doves into the air.
After the ceremony, the casket was laid to rest near Osu Castle, the seat of government where Mills had lived and worked since he became president.
The late president's body was laid out for public viewing Wednesday and Thursday. Some of the visiting heads of state took turns to file past the body Friday morning.
Giant screens were set up around the country for those who could not travel to Accra to watch the ceremony.
One Ghanaian mourner at the funeral said he prayed for the sense of unity that has followed Mills' death to continue.
"I'm confident we will have an even more peaceful election this December because most Ghanaians I have spoken to say they enjoy the atmosphere and will urge the politicians to keep it that way", he said.
Mills died suddenly at a military hospital a few hours after becoming ill, his Chief of Staff John Henry Martey Newman said in a statement at the time. The president had denied rumors about his health for months before his death.
John Dramani Mahama, formerly Ghana's vice president, was sworn in as the country's new president within hours of his death on July 24.
Taking office, he paid tribute to Mills as a "prince of peace" who "brought a distinctive insight into Ghanaian politics."
Mills, a former law professor and a tax expert, was Ghana's vice president from 1997 to 2000.
He became president in 2009, narrowly winning a runoff vote, having unsuccessfully run for the top office in 2000 and 2004.
Before his political career, he taught at the University of Ghana and also was a visiting lecturer at Temple University in Pennsylvania and Leiden University in the Netherlands.
Mills' death came several days after he celebrated his 68th birthday. He had said he would run for re-election in December.
U.S. President Barack Obama met with Mills when he visited Ghana in July 2009. Obama praised the country as a model for democracy and stability when Mills visited Washington this year, saying that it had become "a wonderful success story economically on the continent."
British Prime Minister David Cameron described Mills as "a tireless defender of democracy in West Africa and across the continent."
Part of a former British colony, Ghana was among the first African countries to gain independence, in 1957. It endured a series of coups before a military dictator, Jerry Rawlings, took power in 1981. Rawlings led Ghana through a transition to democracy about 10 years later.
Journalist Israel Laryea contributed to this report.