Some made the sign of the cross, others simply spent a few moments gazing at Mandela's face through a glass bubble atop the coffin at the Union Buildings, the government offices in South Africa's capital, Pretoria.
Leaders like Zimbabwe President Robert Mugabe, South African President Jacob Zuma and others passed by the casket in two lines. Four junior naval officers in white uniforms kept watch. Celebrities like singer Bono of the band U2 also paid their respects. So did F.W. de Klerk, the last president of white rule who shared a Nobel Peace Prize with Mandela for ending the apartheid era.
"My thought now is that I hope that his focus on lasting reconciliation will live and bloom in South Africa," de Klerk later said.
Mandela's widow Graca Machel, his former wife Winnie Madikizela-Mandela and other family members also viewed his body.
Some appeared lost for a moment looking down at Mandela. South Sudan's Salva Kiir Mayardit stood transfixed before removing his trademark black cowboy hat and crossing himself.
Police officers were a few steps away, one holding a box of tissues. Some clearly were overcome by the sight, one woman covering her entire face, weeping as she walked away supported by a colleague. Others carried posters bearing Mandela's image.
"I just hope I won't cry," said Paul Letageng, 47, an employee there. "It's amazing to think that 19 years ago he was inaugurated there, and now he's lying there. If he was not here we would not have had peace in South Africa."
Mandela emerged from 27 years in prison under the white racist government in 1990, appealed for forgiveness and reconciliation and became president in 1994 after the country's first all-race democratic elections. He gave his inaugural address from the amphitheater, which Zuma named after him by decree.
Mandela said at his inauguration: "Out of the experience of an extraordinary human disaster that lasted too long, must be born a society of which all humanity will be proud."
On Wednesday morning, motorcycle-riding police officers escorted the hearse from a military hospital outside of Pretoria to the Union Buildings. People lined the streets to watch the procession, singing old songs from the struggle against the apartheid regime and calling out their farewells to Mandela, who died Dec. 5 at the age of 95. Police blocked traffic, backing up cars for several kilometers (miles) on a highway leading into Pretoria.
Army helicopters had been circling overhead but then a sudden quiet fell over the amphitheater as the hearse arrived. Eight warrant officers representing the various services and divisions of the South African National Defense Force carried the casket, led by a military chaplain in a purple stole. The officers set down the coffin and removed the flag.
Officials have banned cameras from the viewing area and asked people to turn off their mobile phones.
Mandela's body will lie in state for three days at the Union Buildings, which the South African government describes as a "modern-day acropolis" atop a hill overlooking Pretoria. The architect who designed it envisioned its two wings, made of half a million cubic feet (14,100 cubic meters) of stone, representing the Afrikaans and English languages spoken in the country - but none of the land's native languages.
Even from its inception, the majestic buildings have long been considered a symbol of governance in the country - and of apartheid until Mandela took office.
Each day Mandela's coffin will be driven back to 1 Military Hospital to be held overnight. Authorities have asked the public to line the street as an honor guard for each trip.
The government set up buses to bring in mourners. At the Pretoria Showgrounds, one gathering point, the line of people waiting for hours started pressing forward against fencing there. Police ended up having to help some children and elderly people away as they feared they'd be hurt in the crush.
Mandela's body will be flown Saturday to Qunu, his home in the Eastern Cape Province. He will be buried Sunday.
On Tuesday, world leaders including United States President Barack Obama eulogized Mandela. In his speech, Obama called Mandela "the last great liberator of the 20th century."
"We will never see the likes of Nelson Mandela again," Obama said. "But let me say to the young people of Africa, and young people around the world - you can make his life's work your own."
___ Gambrell reported from Johannesburg. Associated Press writer Ben Curtis also contributed to this report.