Polls have shut in South Africa's elections, widely seen as a test for the ruling ANC.
The party is forecast to have a reduced majority following anger over the economy and land reform.
Casting his vote in the country's sixth democratic national election since apartheid ended 25 years ago, President Cyril Ramaphosa apologised.
He said South Africa would "never again" see the "rampant corruption" of recent years.
"We have made mistakes but we have been sorry about those mistakes and we are saying our people should reinvest their confidence in us," Mr Ramaphosa said.
"Corruption got into the way, patronage got into the way and not focusing on the needs of our people got in the way," he added.
The African National Congress (ANC), which led the fight against apartheid, has governed the country since 1994. The centrist Democratic Alliance (DA) and the Economic Freedom Fighters (EFF) are its main challengers.
Opinion polls suggest that the ANC will get just over 50% of the vote with the DA forecast to get about 20%, reports AFP news agency.
If the poll proves to be true then this would mean a fall in the ANC's vote share. It won 62% of the vote in 2014.
Why has the ANC lost support?
There are concerns about voter apathy. Despite more than 26 million people registering to vote, the highest number in South Africa's history, local surveys suggest that six million people under the age of 30 are not on the electoral roll.
Young people queuing to vote spoke of their difficulties in finding jobs, with unemployment at 27%.
One young voter said that her future employment prospects were on her mind. "I don't feel confident about getting the job I want," she said.
Apartheid, in place from 1948 to 1994, legalised racial discrimination privileging white people, and land ownership has remained a contentious issue.
The white minority still owns disproportionately more land than the black majority. The EFF has led the charge in trying to change this.
"I'm a member of the ANC but I didn't vote for them this time," construction worker Thabo Makhene told the Reuters news agency. "They need to catch a wake-up. The way they run the state, mishandling state funds, they've lost their morals."
Many voters stayed loyal to the ANC.
I am celebrating the fact that our country is now ruled by black people"
Esau Zwane, 90, waiting to vote in Soweto, Johannesburg, lived under white-minority rule. He told the BBC he was celebrating "that our country is now ruled by black people".
The BBC's Andrew Harding in Johannesburg says the party's stance has forced the ANC to consider drastic measures to transfer more land, more quickly, into black hands, which has resulted in a pledge to conduct land expropriation without compensation.
The main opposition party, the DA, says it does not believe land reform needs to be "carried out in a way that takes from one to give to another", and instead promises to prioritise land reform in the budget and to release unused government land.
Other election issues include discontent over poor basic services such as water, housing and electricity and anger over violent crime.
As well as the continued inequalities, it is thought that the failure to tackle corruption has damaged the ANC.
President Cyril Ramaphosa came to power last year pledging to get to grips with the issue but some voters still associate the party with the corruption which thrived under his predecessor, Jacob Zuma.
Mr Zuma faces trial on numerous charges of corruption but has denied any wrongdoing.
Election in numbers:
- 26.76 million registered voters
- 55% of them are female
- A record 48 parties are on the ballot
- 28,757 voting stations
- 220,000 members of electoral staff
- Six million young people did not register to vote
'Voting out of a sense of obligation'
Shingai Nyoka, BBC News, Norwood
For most of the day, the lines here at the polling station in the Johannesburg suburb of Norwood have been relatively long.
People have braved the winter chill and some rain to vote in what is being seen here as one of the most hotly contested polls since the first democratic elections 25 years ago.
The ballot paper is half a metre long, filled with new political parties including a former residence association, and a pro-local content media group.
Two young women in their 20s, who are voting for the first time, told me they don't believe promises made by any of the parties, especially the promise to create jobs. They say they are voting out of a sense of obligation.
Another man tells me he is happy with the leaders of the three major parties. "It's the best it has ever been," he said.
The location of Norwood polling station reflects some of the key electoral issues, especially the economic inequality that South Africa has come to be known for.
On one side is Houghton estate with its swanky, expensive mansions cloistered in gated communities. It is where Nelson Mandela, South Africa's first democratically elected president, lived after his release from 27 years in prison.
The party leaders:
On the other side are the overcrowded suburbs of Yeoville and Hillbrow, with their grinding poverty and high crime rates. They are also home to migrants from neighbouring countries seeking a better life.
Some of the people who live here feel let down by the governing African National Congress (ANC) since it took power in 1994. The party has reduced poverty, especially amongst the black majority, but not enough in the eyes of some.
Youth unemployment stands at 54% - a truly staggering figure.