Kazakhstan's President Nursultan Nazarbayev, the only man to lead the country since it emerged from the collapse of the Soviet Union in the early 1990s, has resigned.
In a televised address, he said the decision was "not easy" but he wanted to help "a new generation of leaders".
Mr Nazarbayev, 78, has been largely unchallenged as leader of the oil-rich nation since 1989.
He will retain much of his influence as head of the governing party.
Mr Nazarbayev will remain at the helm of the influential security council and will hold the formal title Leader of the Nation.
"I have decided to give up my powers as president," Mr Nazarbayev said during his surprise television address on Tuesday.
As chairman of the security council, he added, he would retain "major powers to determine the country's external and domestic policies".
"I see my task now in facilitating the rise of a new generation of leaders who will continue the reforms that are under way in the country."
Mr Nazarbayev said the speaker of the upper house of parliament, Kassym-Jomart Tokayev, would take over as acting president for the remainder of his term which expires in April 2020.
The former steel worker had been widely expected to seek re-election and has never indicated a successor.
The announcement comes just weeks after the leader sacked the country's government, citing failures to improve the economy.
"In many areas of the economy, despite the adoption of many laws and government decisions, positive changes have not been achieved," he said in a statement at the time.
A surprise announcement
Analysis by Abdujalil Abdurasulov, BBC News
In the past few months and even years, there has been speculation about Mr Nazarbayev's imminent resignation.
These rumours reached a new level recently when he formally requested the Constitutional Court to clarify the process of a presidential resignation. The court confirmed that the president had a right to resign.
However, his announcement today still caught many by surprise.
Mr Nazarbayev is the only president independent Kazakhstan has known. Many regarded him as a president for life, a common practice for authoritarian states in Central Asia.
He enjoyed great popularity, although it was never possible to independently measure it due to the lack of free and fair elections. Yet, because of the economic crisis, he has faced growing discontent from some of the population.
Born in 1940, Mr Nazarbayev came to power as first secretary of the Communist Party of Kazakhstan in 1989 when it was a Soviet republic.
After independence, he was re-elected against largely token opponents in 1999, 2005, 2011 and - most recently - in 2015.
But the conduct of every election was criticised by foreign observers.
During his long period in office Mr Nazarbayev has focused on economic reform while resisting moves to democratise the political system.
Critics have accused him of corruption and widespread human rights abuses, as well as fostering a personality cult.
His supporters say he preserved inter-ethnic peace and stability during the reform in the 1990s, and credit him for the country's impressive economic growth in first decade of the new millennium.
Kazakhstan is as large as Western Europe and has vast mineral resources.
Since independence following the collapse of the Soviet Union in 1991, major investment in the oil sector has brought rapid growth.
The country is ethnically diverse. The Kazakhs make up nearly two-thirds of the population, ethnic Russians just under a quarter, and smaller minorities the rest. Its main religion, Islam, is also undergoing a revival.