Queen Elizabeth II's three visits to Malaysia – in 1972, 1989 and 1998 – spanned its transformation from an underdeveloped, commodity-dependent economy to one of the world's fastest-growing exporters of manufactured goods.
Inevitably, this changed the attitudes of Malaysians towards Britain – and towards the British monarchy.
In 1972, the last British troops had only just left Malaysia; thousands had been stationed there even after independence, to protect the new country from a communist insurgency and from attacks by Indonesia, which in the early 1960s viewed Malaysia as a neo-colonial creation.
Back then, British-owned businesses still controlled much of the economy, which was heavily dependent on exports of rubber and tin. Britain was the biggest foreign investor – today, it's only the country's 19th largest trading partner.
By 1998, under the mercurial leadership of Prime Minister Mahathir Mohamad, Malaysia was one of the so-called "tiger economies" of South East Asia, an essential link in the global supply chain, much wealthier, though suffering that year from a regional financial crisis.
Dr Mahathir, the first Malaysian leader not to be educated in Britain, mistrusted Western influence. He saw himself as a champion of the developing world and had introduced a "Look East" strategy, to learn from other fast-growing Asian countries. At one time, he had even brought in a "Buy British Last" policy.
He had little time for royalty, Malaysian or British, and had been sceptical of the Commonwealth's value, viewing it as a British-dominated talking shop that did little.
However, the battle within the Commonwealth in the 1980s over apartheid-ruled South Africa seemed to soften his view of it. Like nearly every other Commonwealth leader Dr Mahathir was a staunch opponent of apartheid.
Then British Prime Minister Margaret Thatcher found herself isolated in her opposition to applying economic sanctions against South Africa. Queen Elizabeth, concerned over the damage this was doing to the Commonwealth and Britain's international standing, opposed the prime minister, a rare occasion on which a dispute between monarch and elected leader became public.
Today, Malaysia remains an important member of the Commonwealth, the project perhaps closest to the late Queen's heart and the principal reason she travelled there.
In 1989, Malaysia hosted its first Commonwealth Heads of Government meeting, the biennial gathering of the now 56-member group, and in 1998 organised the first Commonwealth Games to be held in Asia.
At the time, those games symbolised Malaysia's modernity. The Queen was shown the stunning new twin towers constructed in Kuala Lumpur's business district and rode on the newly-built metro system.
She also went to Shelter Home, a centre for abandoned children run by James Nayagam, a royal visit he remembers vividly.
"I received a call from the British High Commission asking me if I would like a visit from the Queen. They asked for no VIPs to be present, just ordinary people, and that the Queen would come into the centre through the kitchen," he said.
"They said she's going to be a volunteer for the day, teaching our girls English. And I thought, wow, that's fantastic, having a very expensive teacher all the way from England.
"I was expecting someone of her stature to be different. But to my surprise, she was just ordinary. She was friendly, pleasant. That helped a lot. And the way she sat down and the way she connected to the girls – they were enjoying the class as if she was there every day of the week."
James and two other friends who had also met the Queen had come to a tea shop in a Kuala Lumpur suburb to rekindle those memories. But these were older men, old enough to recall the young Queen's portrait hanging on their parents' walls in the last years of British rule in the 1950s.
Efforts to get a response to Queen Elizabeth's death from younger Malaysians yielded little. They had all heard of her, of course. But they seemed unaware of her links to Malaysia and knew little about the Commonwealth.
"I don't know much about her, but I do follow the Royal Family," said Elaine, who was selling homemade earrings at an arts and crafts stall in Kuala Lumpur. "I even watch documentaries about her and I think she's a great leader.
"But the younger generation don't know much about her, because they don't know much about history. All they know is about social media – TikTok, Facebook, Instagram and things like that."
Evette, who was helping her friend run a used clothing stall, said: "I think she's been a very strong, independent woman figure. Being a woman, and such a high authority in England, I think it inspires all of us women here in Malaysia."
Kishva Ambigapathy was one young person who had actually met Queen Elizabeth on several occasions, but that was in his role as head of the Commonwealth Youth Council.
"It was inspiring to have those conversations with her, because she always showed her leadership, she always showed how you create solutions, how you always create opportunities from difficulties.
"With her position, her prestige, she could always convene a lot of stakeholders. And she has seen so many historical events. That wisdom brings a lot of value to young people."
The Commonwealth is Queen Elizabeth's greatest legacy outside Britain, but also one whose future is uncertain.
"I think the Commonwealth is still relevant," says Prof Sufian Jusoh from the National University of Malaysia, who advises the government on trade, "for the cultural and educational links, and of course the legal system – we inherited the common law system from the British, which has been very effective.
"But it should be reformed so that it stays relevant. There are lots of activities, but not very well-publicised. It is not as popular or well-known as other organisations, despite having more than 50 members."
In its early days, the Commonwealth played an important part in smoothing the transition from empire to independence, ensuring Britain continued to have a close relationship with its former colonies.
But Vinod Sekhar, one of Malaysia's most successful entrepreneurs, wants King Charles III to move it beyond its post-imperial identity.
"I don't look at the Commonwealth as this former imperial structure. I just look at it from the opportunity of, 'Hey guys, we have this club.' It is an incredible union of countries that have a common thread of history," he says.
"Why don't we mould this club into what we need today – and especially Malaysia; we are not a political power, we are not a military power, we are a trading power. We need to lead in trade, we need to bring people together. Now surely the Commonwealth provides an opportunity for us to lead?"
That is ambitious. With so many other regional trade arrangements in the Asia-Pacific region either in existence or being negotiated, it is hard to see where the political will might come from to turn the Commonwealth into yet another.
But without Queen Elizabeth's authority and determination to keep the members of her former empire linked to each other, the Commonwealth may need new ideas and a new sense of direction, to keep going.
The impressions she left on those she met in Malaysia are more certain to endure.
"When I read that she had passed away," says James Nayagam, "I sat down. There was a silence in me, as I thought about this person I had met. And what a memory, for me and my family, of this lady – this special lady – who has enriched our lives."
Even Mahathir Mohamad, at 97 years old the great survivor of Asian politics and once the sworn enemy of British influence, was moved to pay tribute to her.
"The Queen was always gracious and hosting her was a pleasure. I really did not expect her to pass away when she did. She was only one year younger than me. She was a good example of a constitutional monarch. Her passing away is a loss, not just to the British, but to people who believe in the rule of law."
What next? A day-by-day guide from now to the funeral
How titles and the line of succession have changed
Nine shows to stream about the Queen
World leaders remember a 'kind-hearted Queen'
What next for Australia after the Queen?
Zelensky aide reveals up to 13,000 war dead
Australian parliament rape retrial abandoned
Palace race incident was abuse, says charity boss
The new generation powering China's protests
Germany helps pay energy bills as prices soar
Weekly quiz: Which nation made Dua Lipa a citizen?
'I am very afraid', says Qatari transgender woman
India makes big strides in African healthcare
Damning report raises tough questions for SA leader
The mystery of the polar dinosaurs
Has the slap affected reviews of Will Smith's new film?
Is attacking Ukraine's power grid a war crime?
Is this the greatest taboo of all?
'I regret the role, not my daughter'
Artemis I: The giant rocket setting new records
© 2022 BBC. The BBC is not responsible for the content of external sites. Read about our approach to external linking.