Sunday's ballot is taking place despite weeks of fighting in the sprawling eastern regions that form Ukraine's industrial heartland, where pro-Russia insurgents have seized government buildings, battled government troops and vowed to disrupt the ballot.
The election, which authorities in Kiev hope will unify the divided nation, came three months after the country's pro-Russia leader fled, chased from power by months of protests over corruption and his decision to reject a pact with the European Union and forge closer ties with Moscow.
Yet the question of who was able to vote Sunday loomed large over the democratic process. Some 35.5 million Ukrainians were eligible to vote, but separatists in the eastern Donetsk and Luhansk regions - which have 5.1 million voters - have vowed to stop the vote.
Military operations had eased for the day, but an AP reporter heard heavy gunfire in the afternoon in the Luhansk region town of Novoaidar.
Little voting was taking place in the east. The regional administration in Donetsk said only 426 of 2,430 polling stations in the region were open Sunday, and none in the city of Donetsk, which has 1 million people. There was no voting in the city of Luhansk either, but some stations appeared to be open in the wider Luhansk region, according to local officials.
Twenty-one candidates are running for president but polls have shown 48-year-old billionaire candy-maker Petro Poroshenko far ahead of the others. If no one gets an absolute majority, a runoff is expected on June 15.
"I am convinced that this election must finally bring peace to Ukraine, stop lawlessness, stop chaos, stop bandit terror in the east," Poroshenko said after casting his ballot in Kiev, where many people wore traditional embroidered shirts in a sign of Ukrainian patriotism.
"People with weapons must be removed from Ukrainian streets, Ukrainian villages and cities," Poroshenko said.
Russian President Vladimir Putin promised Friday to "respect the choice of the Ukrainian people" and said he would work with the winner, in an apparent bid to ease Russia's worst crisis with the West since the Cold War and avoid a new round of Western sanctions.
Many voters appreciate Poroshenko's pragmatism and his apparent knack for compromise, making him stand out in a political environment long dominated by intransigent figures. Poroshenko strongly backs closer ties with the 28-nation EU, but also speaks about the need to normalize ties with Russia.
"He is a very smart man who can work hard compared to others, and he is also a businessman and knows that compromises are necessary even if unpleasant," said 55-year old Kiev teacher Larisa Kirichenko, who also voiced hope that Poroshenko will negotiate a peaceful solution to the problems in the east.
Overall, about 40 percent of the nation's eligible voters cast their ballot by 3 p.m., the Ukrainian Election Commission said.
Poroshenko's nearest challenger is Yulia Tymoshenko, the charismatic and divisive former prime minister. The 53-year-old blond-braided heroine of the 2004 Orange Revolution, who spent 2 1/2 years in prison on abuse of office charges denounced as political by the West, is still admired by many for her energy, but detested by others over her role in the political infighting that weakened the country.
Tymoshenko said after casting her ballot that Ukraine must join the EU and NATO - moves that would be sure to anger neighboring Russia.
"I am convinced that Ukraine can be strong, happy and prosperous if it becomes a member of the European Union," she said. "It is time to conduct a referendum on NATO membership in order to bring peace back to the country."
Vladislav Golub, a 31-year old lawyer, said he voted for Tymoshenko because "Ukraine must stop being an oligarchic state and be part of Europe, instead of serving the interests of the Russian Federation."
The interim Kiev government and the West have accused Russia of backing the separatist uprising. Moscow has denied the accusations but annexed Ukraine's Black Sea peninsula of Crimea after a separatist vote there.
Ukraine and the rest of the world have not accepted Moscow's annexation of Crimea, so residents there who wanted to vote Sunday were allowed to travel to other areas in Ukraine. It was not clear how many were doing so.
Ukrainian election officials said they have received as little as 26 percent of the election registers for the Donetsk region and 16 percent for the Luhansk region. Ukraine's deputy interior minister, Serhiy Yarovyi, said police could only ensure security at polling stations in just nine of the 34 electoral districts in the east.
There were plenty of disruptions Sunday in Donetsk. A convoy of an armored personnel carrier and seven trucks carrying several hundred heavily armed men drove through central Donetsk early Sunday. The gunmen got out of the trucks, stood to attention and shot into the air in jubilation as several thousand supporters cheered them and chanted: "Heroes!"
A team of insurgents visited polling stations Sunday in Donetsk to make sure they were closed. At one station, Vyacheslav Kucher, 36, tested the front door and gave a thumbs-up sign after finding it locked.
"I am checking to see everything is normal, to see that there is no nonsense, so this junta doesn't come to power," Kucher said.
Outside the Donetsk administration building, which has been occupied by rebels since early April, a group of masked men drove up carrying confiscated ballot boxes and made a show of smashing them in front of news cameras.
One polling station in Donetsk opened but minutes later a group of gunmen arrived and forced the election commission out, its chief, Nadia Melnyk, told Ukraine's Channel 5.
Gunmen also stormed the Donetsk region village council in Artemivka that was hosting a polling station and set it ablaze, the Ukrainian Interior Ministry said.
Yet some parts of the Donetsk region remain under greater government control so voting could take place.
In the Azov Sea port of Mariupol, 202 out of the city's 216 polling stations were working. Just over a week ago, Rinat Akhmetov, the billionaire metals tycoon who is Ukraine's richest man, had workers from his factories in Mariupol join police to patrol the city and evict the pro-Russia insurgents from the government buildings they had seized.
"I want order in this country. We can't continue without a president. We need order," voter Gennadiy Menshykov said in Mariupol.
In the town of Krasnoarmeisk, in the western Donetsk region, a trickle of people came out to cast their ballots.
Ivan Sukhostatov, 37, said he had voted for peace.
"We came to show that this whole situation is contrived," he said. "One side are called terrorists, the others get called fascists. But we have no differences between us. We have one faith, we speak one language. We just want there to be peace."