Kim Jong Un talks with an adviser during a parade at Kim Il Sung Square in Pyongyang, North Korea, on May 10.  (Linda Davidson/The Washington Post)

Kim Jong Un stood on the stage in front of stylized portraits of his father and grandfather, men he wasn’t supposed to be strong enough or cunning enough to succeed, lauding the “thrilling explosion” of the most recent nuclear test and the “leap forward in all sectors of the national economy.”

His Western-style suit, his haircut, his glasses, even his gravelly voice were all reminiscent of his grandfather, Kim Il Sung, the founder and “eternal president” of North Korea, who, to this day, is associated with strength and prosperity.

In front of him in the huge hall were 3,467 delegates, called in May to the first congress of the ruling Workers’ Party since 1980, before Kim Jong Un was even born. Among them were hard-nosed party stalwarts, the sort who had been expected by some analysts to turn against the inexperienced upstart when he first rose to the top. But there they were: men in military uniforms covered to the waist in medals, cheering party officials, scientists, the editor of the party newspaper, anti-Japanese revolutionary war veterans, field laborers.

It was Kim’s moment. It was his way of saying, “I’m in charge here.” And these were the people who were keeping him in power: the North Korean loyalists who, like Kim, have a vested interest in keeping the world’s most repressive regime intact.

Their support enabled Kim to celebrate his fifth anniversary as the leader of North Korea on Saturday, propelling the communist monarchy into its 71st year.

(Jason Aldag/The Washington Post)

The Kim family has ruled the country through fear and favors since the end of World War II, when Kim Il Sung was chosen by Joseph Stalin to run it as a Soviet client state. His son, Kim Jong Il, continued the family rule for 17 years, until his death five years ago Saturday at age 69.

The founder’s grandson, Kim Jong Un, was then anointed as the Great Successor in a country where the Kim family is deified and its supporters live large, while the remaining 20-odd million North Koreans struggle to feed their families and heat their shabby homes.

During the transition, plenty of people who make a living studying North Korea from abroad predicted the system’s demise, doubtful that a Swiss-educated Chicago Bulls fan with no military background and none of the revolutionary myth of his forebears could retain control of a country run by hard-line octogenarians.

But he has.

Five years on, the Kim regime has not just held together, it is relatively strong.

The economy has been growing, if not booming. The country has functioning nuclear weapons and is making rapid progress toward being able to deliver them to the continental United States.

Kim has given his closest ally, Chinese President Xi Jinping, the cold shoulder and suffered little for it. He has threatened to attack the United States and has actually attacked South Korea, but the sanctions imposed as punishment have fallen well short of fatal.

“He has been a good dictator in the sense that he has behaved in accordance with the rules,” said Bruce Bueno de Mesquita, a political scientist at New York University who describes how authoritarian leaders around the world retain power in his book “The Dictator’s Handbook: Why Bad Behavior Is Almost Always Good Politics.” “He has governed through corruption and rent-seeking and keeping the population miserable.”

And there’s no reason to expect Kim to be going anywhere soon, Bueno de Mesquita said. If they survive the first two years, most dictators die in their sleep.

Ken Gause, a North Korea leadership expert at CNA, a research company in Arlington, Va., agreed that Kim seems firmly in control — at least for now.

“You have a leader who is becoming more comfortable in his own skin and is able to delegate and manipulate the levers of power in a much more sophisticated way,” Gause said. “I would say he is still working on building and solidifying his power. But for all intents and purposes, he is the leader in every sense of the word.”

Keeping ‘the loyalists loyal’

For kleptocratic dictators the world over, the key to staying in power is keeping the elite happy and rivals scared.

Nowhere is this the case more than in North Korea.

Kim has retained power by relying on a relatively small group — perhaps a couple of hundred military officials, Politburo members and money-makers who also have an interest in keeping him at the helm. When he convened the congress in May, he put more of his core supporters into positions of power. Regimes like this stay intact by spending money on the military and the apparatchiks instead of on the masses.

“He’s paying the people who keep him in office enough so they won’t defect to anyone else,” Bueno de Mesquita said. “He needs to keep the loyalists loyal.”

And for the loyalists of Pyongyang, life is the best it has been in decades.

There are new high-rise apartment buildings popping up everywhere, although the lower floors are most desired since there isn’t enough electricity to power the elevators. There’s a pizza restaurant in the city and a German beer hall, amusement parks and swimming pools. Supermarkets stock Japanese mayonnaise and French wine. Taxis are everywhere. With money, anything is possible.

And increasingly, people have money.

Once reliant entirely on the state, North Koreans have been increasingly allowed to operate in capitalist ways. Factory managers and co-operative farmers have more freedom to innovate, as long as they meet their state quotas, and private trade in products from television sets to chewing gum is now tolerated. A recent study from Seoul’s Korea Institute for National Unification estimated that the North Korean government collects between $13 million and $17 million each day in fees from market traders.

A new class of “donju,” or “masters of money,” has emerged in this space between state and private activity, using their positions in the regime — many travel to the outside world, where they can trade — to enrich their leader and themselves.

But while tinkering at the margins, Kim has operated very much according to the playbook written by his grandfather. He has elevated the standing of the Workers’ Party and emphasized economic development, both of which under his father were subordinated to the military and nuclear weapons.

There is no doubt that the economy is a shadow of what it could be. State factories remain stuck in the Soviet era, if they are operating at all. Tough multilateral and direct sanctions imposed after nuclear and missile tests are biting.

Those sanctions threaten the foreign-currency earnings that Kim needs to continue underwriting the lifestyles of the North Korean upper crust and keeping them happy.

But the country is still in its best economic shape in decades, with growth of about 2 or 3 percent, according to private-sector analysts, much better than in the years of contraction under his father.

If Kim, who turns 33 on Jan. 8, maintains the support of North Korea’s top tier, he could remain in power for decades to come, said Sue Mi Terry, a former North Korea analyst at the CIA.

“The junior Kim has already ruled for five years and could conceivably rule for another 50 years,” she said, “if he maintains the support of North Korea’s elites, ‘the shareholders’ in his regime.”

But there will be challenges.

“While the elites as a group by and large still support him, there are signs of growing discord among the ruling class as it struggles for power and influence,” Terry said, noting that there have been several high-profile defections from the regime this year.

But Kim doesn’t just use money to curry favor; he uses Stalinist-style purges to instill fear. Since he took power, at least 100 top-level officials have been purged or executed.

Most notably, he had his own uncle, Jang Song Thaek, hauled out of a meeting at the end of 2013 — broadcast on television — and denounced as a “traitor for all ages,” then killed.

“The elites know that if Kim can turn on his uncle and other high-ranking officers like he did, any of them could be next in his gun sights,” Terry said.

Cheong Seong Chang, a leadership expert at the Sejong Institute outside Seoul, said the purges are a sign of Kim’s strength.

“If Kim Jong Un’s power base was weak, it would have been risky to execute these high-ranking officials,” he said, noting that the younger Kim executed many fewer people than his father did — about 2,000 — during his own transition period. “These executions show that he has absolute power.”

‘Charming and gregarious’

For one of the world’s most threatening figures, very little is known about Kim as a person.

Intelligence from inside the isolated state is notoriously thin, and only a handful of outsiders have met him. The only Americans to have spent any time with him are Dennis Rodman, the former Chicago Bulls basketball player, who visited the country three times, and his entourage.

Joe Terwilliger, a New York geneticist who accompanied Rodman on two of his trips, said Kim is very different in person from the outside world’s caricature of him.

“He’s charming and gregarious, and very friendly. He told a lot of jokes, and we had open conversations about every imaginable topic, like hanging out with old friends,” said Terwilliger, who went jet-skiing with Kim at his summer house and sang karaoke in front of him. “He especially likes sports, music and movies, and even asked about Sylvester Stallone.”

Since taking over, Kim has cultivated an image as a man of the people. He’s gone on rides at one of Pyongyang’s new amusement parks. Unlike his father, who never appeared in public with any of his wives, Kim is often accompanied by his fashionable spouse, Ri Sol Ju.

Kim and Ri, who are believed to have two or three young children, have visited Pyongyang residents in their apartments, sitting on the floor with them. Kim has even poured drinks for his hosts — a humble gesture in a culture that prizes seniority and protocol.

State media shows Kim with a much smaller retinue than his father had, and he is tactile, often slapping backs and clasping hands, a huge smile on his face.

Experts have been trying to psychoanalyze North Korea’s leaders for decades, but it’s hard given how few clues there are. The popular view is of a nuclear-armed madman, but such mockery risks underestimating Kim.

“People like him are not crazy, and they are not erratic,” said Bueno de Mesquita, the NYU political scientist. “They are carefully calculating.”

But given Kim’s capacity for brutality, his short temper and his apparently impulsive tendencies, there is reason to be concerned about his hot-headedness, said Jerrold Post, a psychiatrist who founded the CIA’s personality analysis center.

“This is all about big boys and their big toys,” Post said. “I must say I’m concerned about words leading to actions between him and President Trump.”

Indeed, Kim has proved quick to escalate tensions, as in the summer of 2015, when a confrontation with South Korea over a land-mine attack brought the two countries to the brink of war.

The next two or three years will be critical for Kim, analysts say, as he solidifies his control and confronts the unconventional Donald Trump administration. But if the past is any guide, it would be prudent to avoid making predictions about the North Korean regime’s imminent demise.

“There has been a lot of wishful thinking going on since the 1990s,” said Gause, of CNA. “I’m not saying that their days are not numbered, but North Korea is a very resilient country. You can’t go on expecting the Kim family to crumble.”

Yoonjung Seo contributed to this report.