Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

ISTANBUL — Turkish President Recep Tayyip Erdogan won a historic referendum Sunday that will greatly expand the powers of his office, telling opponents who promised to challenge the results: "It's too late now."

Erdogan initially struck a conciliatory tone, thanking all voters regardless of how they cast their ballots and describing the referendum as a "historic decision."

"April 16 is the victory of all who said yes or no, of the whole 80 million, of the whole of Turkey of 780,000 square kilometers," Erdogan said.

Supporters of Turkish President Recep Tayyip Erdogan during a rally near the headquarters of the conservative Justice and Development Party (AKP) on April 16 in Istanbul. Ozan Kose / AFP - Getty Images

But he quickly reverted to a more abrasive style when addressing thousands of flag-waving supporters in Istanbul.

"There are those who are belittling the result. They shouldn't try. It will be in vain," he said. "It's too late now."

With nearly all ballots counted, the "yes" vote stood at 51.41 percent, while the "no" vote was 48.59 percent, according to the state-run Anadolu Agency. The head of Turkey's electoral board confirmed the "yes" victory and said final results would be declared in 11 or 12 days.

Turkey's main opposition party alleged that the results were skewed.

Erdogan has long sought to broaden his powers, but a previous attempt failed after the governing party that he co-founded fell short of enough votes to pass the reforms without holding a referendum.

Opponents argued the plan concentrate too much power in the hands of a man they allege has shown increasingly autocratic tendencies.

The outcome is expected to have a huge effect on Turkey's long-term political future and its international relations. Although the result, if officially confirmed, would fall short of the sweeping victory Erdogan had sought, but nevertheless cements his hold on the country's governance.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Related: Turkey Votes in Poll on Expanding Erdogan's Power

Prime Minister Binali Yildirim, whose position will be eliminated under the presidential system of government called for in the referendum, also welcomed the results and extended a hand to the opposition.

"We are all equal citizens of the Republic of Turkey," he said. "Both the ones who said 'no' and the ones who said 'yes' are one and are equally valuable."

A woman holds her ballot in the referendum on expanding the powers of Turkey's president. OZAN KOSE / AFP - Getty Images

"There are no losers of this referendum. Turkey won, the beloved people won," Yildirim said, adding that "a new page has opened in our democratic history with this vote. Be sure that we will use this result for our people's welfare and peace in the best way."

Erdogan supporters gathered outside the AK Party headquarters in Istanbul to celebrate, sending fireworks into the night sky.

But the main opposition People's Democratic Party, or CHP, cast doubt on the results. CHP vice chairman Erdal Aksunger said they would challenge 37 percent of the ballot boxes.

"Our data indicates a manipulation in the range of 3 to 4 percent," the party said on its Twitter account.

The country's pro-Kurdish opposition party, which also opposed the constitutional changes, said it plans to object to two-thirds of the ballots.

An unprecedented decision by Turkey's Supreme Election board to accept as valid ballot papers that don't have the official stamp also drew the ire of the CHP, with the party's deputy chairman, Bulent Tezcan, saying the decision had left the referendum "with a serious legitimacy problem."

Macide Dogan, 67: Erdogan is one in a million leader. I'm a Yes voter as a conservative Muslim and I've seen Turkey's development under him. pic.twitter.com/8cywsrkJbm — Umut Uras (@Um_Uras) April 16, 2017

The board made the announcement after many voters complained about being given ballot papers without the official stamp, saying ballots would be considered invalid only if proven to have been fraudulently cast.

Sunday's vote approved 18 constitutional changes that will replace Turkey's parliamentary system of government with a presidential one, abolishing the office of the prime minister and granting sweeping executive powers to the president. The changes will come into effect with the next general election, scheduled for 2019.

Erdogan and his supporters had argued the "Turkish-style" presidential system would bring stability and prosperity in a country rattled by a failed coup last year that left more than 200 people dead, and a series of devastating attacks by ISIS and Kurdish militants.

But opponents fear the changes will lead to autocratic one-man rule, ensuring that the 63-year-old Erdogan, who has been accused of repressing rights and freedoms, could govern until 2029 with few checks and balances.

The ballots themselves did not include the referendum question — it was assumed to be understood. Voters used an official stamp to select between "yes" and "no."

At one Istanbul polling station, eager voters lined up outside before it opened at 8 a.m.

"I don't want to get on a bus with no brake system. A one-man system is like that," said Istanbul resident Husnu Yahsi, 61, who said he was voting "no."

In another Istanbul neighborhood, a "yes" voter expressed full support for Erdogan.

"Yes, yes, yes! Our leader is the gift of God to us," said Mualla Sengul. "We will always support him. He's governing so well."

Erdogan first came to power in 2003 as prime minister and served in that role until becoming Turkey's first directly elected president in 2014.