TUNIS - Tunisians voted in the runoff of the country's first free presidential election on Sunday, after authorities urged a big turnout to consolidate democracy following a chaotic four-year transition.
Anti-Islamist Nidaa Tounes party chief Beji Caid Essebsi, 88, quickly claimed victory over incumbent Moncef Marzouki, whose camp dismissed the claim as unfounded.
After polls closed at 1700 GMT, Essebsi's campaign manager Mohsen Marzouk said early indicators signalled an Essebsi victory, without elaborating.
Official results are due as early as Monday evening.
Essebsi appeared on national television to thank voters while his supporters gathered outside his campaign headquarters shouting "Long live Tunisia!"
However, Marzouki's campaign chief Adnene Mancer said the result was too close to call, and accused the rival camp of election "violations".
It is the first time Tunisians have freely elected their president since independence from France in 1956, with many describing the vote as a landmark for democracy in the country where the Arab Spring was born.
Just hours before polling stations opened at 0700 GMT, troops guarding ballot papers in the central region of Kairouan came under attack and shot dead one assailant and captured three, the defence ministry said.
Prime Minister Mehdi Jomaa condemned what he called a "desperate attempt" to disrupt the election, in a statement to a private radio station.
He later told AFP that what had happened was of no "impact", adding that the security situation was under control.
The authorities had deployed tens of thousands of soldiers and police to provide security on polling day.
Ahead of the vote, which sets Tunisia apart from the turmoil of other Arab Spring countries, jihadists issued a videotaped threat against the North African state's political establishment.
But voters seemed unfazed.
"This is a big day. I am proud to take part in this historic moment," said Bechir Ghiloufi, a 54-year-old bank director in Tunis.
"It is important to progress towards democracy."
Raja Gafsi, a 58-year-old worker, said: "It is time to move on and set up long-lasting institutions."
Like most voters, he was anxious to see a return to political and economic stability and security.
Mudslinging during the campaign
A first round on November 23 saw Essebsi win 39 per cent of the vote, six percentage points ahead of Marzouki, a 69-year-old former rights activist installed by parliament two months after December 2011 polls.
Nidaa Tounes won parliamentary polls in October, making Essebsi favourite to be the next president, but with powers curbed under constitutional amendments to guard against a return to dictatorship.
The campaign was marked by mudslinging, with Essebsi refusing to take part in a debate with Marzouki, claiming his opponent is an "extremist".
Essebsi insists that Marzouki represents the Islamists, charging that they had "ruined" the country since the 2011 revolution which toppled veteran ruler Zine El Abidine Ben Ali and sparked the Arab Spring.
Marzouki in turn accused Essebsi, who served as a senior official in previous Tunisian regimes, of wanting to restore the old guard deposed in the revolution.
After polling closed on Sunday, Essebsi said in an indirect message to his rival: "The future obliges us to work together for Tunisia."
Earlier Marzouki had said: "The rules of the democratic game require that each of us accepts the outcome of the vote in a sporting spirit."
'The dictatorship is over'
Voters said they regretted the lack of restraint shown by candidates during campaigning, but said they believed Tunisia was on the path to democracy.
"Our candidates and their policies perhaps aren't the best but we're moving forward -- the dictatorship is over," said shopkeeper Mohammed Taieb.
In an Internet video posted on Wednesday, jihadists claimed the 2013 murder of two secular politicians that plunged Tunisia into crisis, and warned of more killings of politicians and security forces.
The murders had threatened to derail Tunisia's post-Arab Spring transition until a compromise government was formed in January this year.
Defence ministry spokesman Belhassan Oueslati said he did not believe jihadists were behind Sunday's pre-dawn attack.
"The vigilance of the soldiers and the swiftness of their response thwarted this operation and led to the death of a man armed with a hunting rifle and the arrest of three suspects," Oueslati told AFP.
"Generally, the terrorists don't use hunting rifles."
Tunisia also faces major economic challenges.
Its economy is struggling to recover from the upheaval of the revolution, and there are fears of widespread joblessness causing social unrest.