PREY NOKOR KNUNG, Cambodia — Once upon a time in this remote corner of Cambodia, a bold young temple servant raised an army, overthrew an unjust king and saved a nation.

He could walk on water, make dragons do his bidding and shoot four arrows at once from the same bow. During his brief 16th-century reign, he invented Cambodia’s first currency, and he pioneered the concept of class consciousness three centuries before Marx.

So goes the unlikely legend of Sdech (or King) Kan, once remembered, if at all, as a minor usurper of the throne. Now he seems to be everywhere, thanks to Prime Minister Hun Sen — another common man turned near-absolute ruler, who has been so intent on identifying himself with the semi-mythical figure that some suspect he considers himself the king’s reincarnation.

At least seven statues of Kan have gone up across Cambodia in recent years, all with facial features strongly resembling Mr. Hun Sen’s. Most were commissioned by wealthy officials and businessmen to show fealty to the authoritarian prime minister, said Astrid Noren-Nilsson, a lecturer at Lund University in Sweden who specializes in Cambodian politics.

“I do imagine that Hun Sen considers himself a reincarnation of Sdech Kan, destined to lead the nation through prowess and might,” Dr. Noren-Nilsson said.

In speeches, Mr. Hun Sen has noted that he and Kan were both born in the Year of the Dragon, a symbolically potent coincidence in a superstitious country. He has sponsored research to find the site of Kan’s capital — which proved to be not far from the prime minister’s birthplace — and paid to have it developed as a tourist attraction. In August, Kan was the hero of a heavily promoted action movie directed by an official in Mr. Hun Sen’s government.

David Chandler, a historian of Cambodia and professor emeritus at Monash University in Australia, said the Kan myth was useful to Mr. Hun Sen, whose biggest early rivals were Cambodian royals, because both men came from common stock.

“He wants to connect himself with some part of Cambodia’s past that doesn’t necessarily have to do with the royal family, and has to do with his part of the country and a certain amount of courage and populism, which he thinks he’s got,” Dr. Chandler said. “There aren’t a lot of characters like Kan in Cambodian history.”

Like Kan — at least, according to the centuries-old chronicles that tell his story, which historians consider unreliable — Mr. Hun Sen was a commoner from Cambodia’s east. Like the king, he lived in a Buddhist temple as a “pagoda boy,” before rising to become a military commander and turning against oppressive rulers.

A onetime Khmer Rouge guerrilla fighter, Mr. Hun Sen switched sides and helped the invading Vietnamese oust the brutal regime, and was installed as premier in 1985. He has maintained control ever since through careful alliance-building, ruthless suppression of dissent and a hefty dose of self-mythologizing, emphasizing his status as a national liberator.

As he has outlived or vanquished rivals, Mr. Hun Sen has gathered more and more power in his own hands and showed a tendency to conflate the state with his personal rule. Along the way, he and his loyalists have subtly pushed the narrative of Sdech Kan as a visionary, redemptive and democratic figure.

Crucial to this project has been Mr. Hun Sen’s sponsorship of research by a pro-government historian to discover the ancient capital of the commoner king.

In the 2000s, around the time Mr. Hun Sen was seeking to stanch the power of a royalist political movement, it was announced that the site had been discovered at Prey Nokor Knung, a poor, remote area near the Vietnamese border. The area is closely associated with Mr. Hun Sen, who was born in the same province and mounted an attack on the Khmer Rouge government from nearby.

Near crumbling brick ruins, the historian unearthed gold coins that he claimed represented Cambodia’s first currency, invented by Kan. (The National Bank of Cambodia now sells replicas for $42).

Once the site was identified, Mr. Hun Sen arranged for the temple ruins and a nearby pagoda to be restored and surrounded with pleasure grounds. It now features statues of tigers and elephants, electric toy SUVs for children to tear around in, and pergolas where families can pose for photographs overlooking a huge new statue of a reclining Buddha.

Nearby, next to a primary school named after Mr. Hun Sen, stands a large equestrian statue of a bow-wielding Sdech Kan. Asked whether the statue did not bear an uncanny resemblance to the prime minister, one of the pagoda’s resident monks, Mom Kosal, cheerfully agreed.

“My understanding, based on my research, is that he thinks he is Sdech Kan because he is a commander himself and he made the statue for himself to show that he is Sdech Kan,” he said.

In August, a movie called “His Royal Highness Sdech Kan” was released to great fanfare, touted as the most expensive Cambodian film ever made, at more than $1 million. It was paid for by Ly Yong Phat, a businessman with close ties to Mr. Hun Sen.

The director, Mao Ayuth, is a senior official at the Cambodian Ministry of Information. But he insisted that the film was a labor of love, not propaganda. In an interview, he spoke animatedly for more than an hour about the details of Sdech Kan’s life and the challenges of bringing them to the screen.

Hanging above Mr. Mao Ayuth’s desk was a photograph of Mr. Hun Sen in military garb at a temple, flanked by a fake sword and other props from the film. Asked whether Kan was meant to represent Hun Sen, he was circumspect, only calling the two men “similar.”

“Both were just smart people who developed the country, according to a lot of documents, by attracting a lot of trade from abroad,” Mr. Mao Ayuth said.

In an October speech, Mr. Hun Sen praised the “glories” of Sdech Kan’s regime, from which he said he had learned much about democratic rule — and how to treat opponents.

“Sdech Kan made the first people’s democratic revolution, even before Lenin, Karl Marx, Engels and other countries, by promising people, ‘For those that support me, I will liberate them from the social class of being a temple servant,’” he said.

Those who did not support Kan, on the other hand, “had no rights and power and were not allowed to work as government officials,” he said. He mused that he might have to follow suit with a purge of “difficult” people.

A month later, the Supreme Court, led by a staunch Hun Sen loyalist, dissolved the Cambodia National Rescue Party, the prime minister’s only viable opposition in elections scheduled for next year. Its leaders had already been jailed or driven into exile. Mr. Hun Sen has since told its officials to join his own Cambodian People’s Party or face serious consequences.

Prince Sisowath Thomico, a member of the Cambodian royal family aligned with what remains of the opposition, called Mr. Hun Sen’s deployment of the Sdech Kan myth “very curious.” He noted that Kan was overthrown and killed after just four years on the throne, by a full-blooded prince reasserting his family’s right to rule.

“Because he is not a king, he has to choose a public figure, and he behaves like a lord,” the prince said of the prime minister.

Dr. Chandler, the historian, said that Mr. Hun Sen increasingly seemed to view himself as an embodiment of the nation, an idea with ominous implications for what is left of Cambodian democracy.

“If you’re the incarnation of the country, you just don’t leave,” he said.