Botswana voted Wednesday in a cliffhanger election set to test the decades-long dominance of the ruling party and challenge the country's image of stability.
The southern African nation's 2,200 polling stations started closing at 1700 GMT as many were still waiting in queues to cast their ballots in the evening.
Independent Electoral Commission (IEC) spokesman Osupile Maroba this would delay counting slightly.
Results are expected as early as Thursday evening. According to the IEC, the winner is declared once a party attains 29 parliamentary seats -- the minimum requirement to form a government.
The Botswana Democratic Party (BDP), which has ruled since independence from Britain in 1966, suffered a seismic jolt in May when former president Ian Khama renounced his hand-picked successor, Mokgweetsi Masisi.
Khama stormed out after accusing his former deputy of autocracy and threw his weight behind the Umbrella for Democratic Change (UDC), once his fiercest critic.
"It's the toughest election we have had to fight," Masisi told reporters after voting in his native village of Moshupa, 65 kilometres (40 miles) east of the capital Gaborone.
"But you know I enjoy a test, I enjoy the challenge," he added.
Masisi maintained that the BDP's victory was "automatic", but said he would concede and "retreat" into opposition if his party did "not make it".
Botswana's founding party saw its share of the vote dip below 50 percent for the first time at the last election in 2014.
That year, the two main opposition parties, which teamed up to form the UDC, won a breakthrough 30 percent of the vote.
This time, the BDP vote share could be around 44 percent of the vote, according to a pre-poll survey carried out by Afrobarometer.
More than 900,000 of the country's 2.2 million people are registered to vote in the elections, which are at parliamentary and local level.
Maroba said voter turnout had reached more than 50 percent.
The BDP, UDC and two smaller parties are vying for the 57 places in parliament, where the party with the most seats chooses the president.
"These elections are too close to call because no single party is sure of the outcome, unlike before," said Tuelo Gaadingwe, 44, a civil servant queueing to cast his ballot near Moshupa.
"Before this split, (the BDP) were assured of 19 seats in parliament before we even started counting votes."
Should Khama fulfil his goal, it would be the first time diamond-rich Botswana has seen a change of government in 53 years.
"We may be looking at a spectacularly different future from what we had so far," said UDC leader Duma Boko after casting his vote in Gaborone.
"To live to see that moment, to be part of it, to make it happen is one of the most humbling experiences," he added.
"I have spotted a candidate I think is the right person and I have to get him in," said banker Chops Maswikiti, 37, who waited all night to cast his ballot in Gaborone.
"He does not belong to the party I voted for in the last two terms but he represents strong sanity on our side," he told AFP.
Khama, whose father co-founded the BDP and served as Botswana's first president, retains plenty of influence, particularly in the central region -- a BDP stronghold -- where he is a traditional chief.
During an interview with AFP on Tuesday, he said the "arrogant" Masisi administration posed a "genuine threat" to "our general democracy, our peace and stability".
"It will actually be good for our democracy... (to) elect a new party to take over," said Khama.
But BDP supporter Boitumelo Dintwe told AFP she was confident the party would win.
"Masisi is intelligent, he is a real leader with a vision," said Dintwe, a 39-year-old perfume seller.
Botswana has an enviable image as a bastion of democracy and continuity in Africa -- a reputation that faces a stern challenge if the results are close.
"These elections are actually a test to how stable the country is," said University of Botswana politics lecturer Gladys Mokhahwa.
The country is similarly touted as a development success story, yet it also suffers from one of the highest levels of income inequality in the world, according to World Bank figures.
Consultant Moepo Mosupiemang, 47, said the gap between the rich and poor was widening.
"We seem to have lost it somehow," Mosupiemang said. "I believe the person we are bringing on board is a fresh person -- he will have the mandate to put the bits and pieces together."
Formerly a British protectorate, Botswana became an independent democracy in 1966 and the BDP has been in power ever since.