After 38 years as president of Angola, Jose Eduardo dos Santos left the nation's highest office Tuesday, but not without making sure he and his family continue to maintain control.
Following an election last month, former Defense Minister Joao Lourenco was sworn in to office, but only after Dos Santos passed decrees shoring up his power and leaving doubts about how much room the new president will have to maneuver.
There was the special constitutional title Dos Santos created for himself: "President of the Republic Emeritus Honorary," which gives him and close family members immunity from prosecution.
There was the decree he signed freezing appointments of military, security and intelligence chiefs until 2025, ensuring his close circle of securocrat allies retains control. He also promoted 165 senior police commanders.
Not least was the fact that he remains head of the ruling Popular Movement for the Liberation of Angola, or MPLA, retaining the power to control the direction of the government.
Lourenco has said Dos Santos will not wield power behind the scenes.
Under Dos Santos, 75, oil-rich Angola has become known as a kleptocracy where for decades he used his sweeping power to enrich his family and members of a tiny elite, while the country remains one of the least developed in the world.
Billions of dollars in oil revenue have gone missing without explanation, according to Human Rights Watch.
Angola's ruling party "has historically mismanaged the country's substantial oil revenues and used its control over oil wealth to insulate itself from public scrutiny," according to the rights group. "The scale of corruption and mismanagement in Angola has been immense."
The nation is ranked as one of the most corrupt, at No. 163 out of 167 countries on the corruption perceptions index published by the nongovernmental corruption watchdog Transparency International.
Meanwhile, more than 36% of the population lives on less than $2 a day, according to the World Bank.
Dos Santos' children hold key positions and control large sectors of the economy including oil and gas, banking and cellphone companies. His most famous daughter, the billionaire Isabel dos Santos, is head of the state oil company Sonangol and Africa's richest woman.
His son Jose Filomeno dos Santos is chairman of Angola's $5-billion sovereign wealth fund, Fundo Soberano de Angola. Another daughter, Welwitschia "Tchize" dos Santos, is a member of the powerful MPLA central committee and has interests in the banking sector.
Although Jose Eduardo Dos Santos has taken steps to cling to as much power as he can, things have not gone entirely his way.
Last year, it looked as if Dos Santos was determined to stay in office. After he announced he would stand down at the end of 38 years in power, posters appeared around the Angolan capital Luanda, calling for him to stay on.
"Comrade President, please continue guiding the destiny of our country, asks the nation," the posters said. But the campaign fizzled.
Dos Santos has been suffering from an undisclosed ailment and traveled to Spain twice this year for several weeks of treatment.
Speculation last year that a close Dos Santos ally, former head of Sonangol, Manuel Vicente, would succeed as president faded, after Vicente was caught up in a corruption scandal in Portugal. He is now facing charges in Portugal over allegations that he bribed Portuguese corruption investigators, accusations he has denied.
The MPLA won the majority of the vote in elections last month, although opposition parties protested irregularities. The country's constitutional court, whose judges are appointed by the president, dismissed their objections.
Lourenco did not win a presidential election but became president when the MPLA won the majority of seats in parliament. A constitutional change in 2010 ended direct presidential elections.
He had campaigned on a promise to reduce poverty and corruption and to create development and jobs. Unemployment is at 26%, and Angola's economy has been shrinking in recent years because of low oil prices.
The nation's gross domestic product fell from $126.7 billion in 2014 to 89.6 billion last year, according to the World Bank.
Dissident investigative journalist and anti-corruption campaigner Rafael Marques de Morais, who runs an independent blog, Maka Angola, wrote recently that Angolans had been ruled for decades by leaders imposed by the MPLA.
"Angola has its third president in history, this time without even the pretense of legitimacy," he wrote.
He said the ruling party won the elections "with the usual cheating, made possible by the MPLA's absolute control of the electoral process."
According to Marques de Morais, the president's family and a few generals and ministers close to the family control most of the economy.
In May, Marques de Morais reported that the reason Dos Santos traveled to Spain was that he had suffered a stroke.
In June, after publishing an expose on a questionable land deal involving the Angolan prosecutor general, Marques de Morais and the editor who published his articles, Mariano Bras Lourenco, were charged with "defamation of a public authority."
According to Amnesty International, the charges, which carry up to three years jail, are politically motivated and designed to deter critics of the ruling MPLA.