The last time a top American official visited this Southeast Asian nation was in 1998, when Vice President Al Gore publicly rebuked its leaders for suppressing freedom and embraced "reformasi," the rallying cry of the student-led protest movement.
On Sunday, President Obama visited Malaysia to underscore how much has changed in the last 16 years — not least in this country's attitude toward the United States, which has evolved from deep-seated suspicion to a cautious desire for cooperation.
Citing negotiations for a trans-Pacific trade accord, a formal agreement to cooperate in halting the spread of nuclear equipment, and the international search for the missing Malaysia Airlines jet, Mr. Obama said, "We're working more closely together than ever before."
Read MoreUS-Japan failure on trade deal sets back Asia pivot
White House officials liken Malaysia to a "swing state" in Southeast Asia, falling somewhere between the freewheeling democracy of the Philippines and the rigid, one-party authoritarianism of Laos. Encouraging Malaysia's evolution into a more open society, these officials said, could make the country a model for the rest of the region.
In many ways, though, Malaysia remains the same work-in-progress it was in 1998, blessed with an industrious, multiethnic population but burdened by a corrupt political system, with a Malay elite that does not hesitate to vilify its opponents with trumped-up charges.
Speaking at a news conference with Prime Minister Najib Razak, Mr. Obama treaded gingerly on these issues. He said he pressed Mr. Najib during their meeting about Malaysia's human rights record, which has come under new scrutiny in recent weeks because of the legal travails of an opposition leader, Anwar Ibrahim.
"The prime minister is the first to acknowledge that Malaysia has still got some work to do on these issues, just like the United States, by the way, has some work to do," the president said.
"Prime Minister Najib came in as a reformer, and one who is committed to it," he said, "and I am going to continue to encourage him as a friend and as a partner to make sure we're making progress on that front."
Still, Mr. Obama declined to meet Mr. Anwar, a former deputy prime minister whose 2012 acquittal on sodomy charges was thrown out by a court last month, putting his political comeback in jeopardy. Mr. Anwar's original conviction in 1999, which led to a six-year prison term, was widely condemned as politically motivated.
Mr. Obama did not offer a reason, but said his decision was "not indicative of a lack of concern, given the fact that there are a lot of people I don't meet with, and opposition leaders I don't meet with, but that doesn't mean I'm not concerned about them." Mr. Anwar will instead get a meeting with the national security adviser, Susan E. Rice.
For some human rights activists, that was not enough. "Anwar, to Malaysia, is almost as important a figure as Aung San Suu Kyi is in Burma," said Andrew Khoo, a prominent human rights lawyer here. "If President Obama took the time to meet with Aung San Suu Kyi, it is a little odd that he wouldn't meet with Anwar."
Read MoreObama reminds North Korea of US 'military might'
Mr. Obama, who is the first president to visit Malaysia since Lyndon B. Johnson in 1966, was keen to keep the spotlight on the country's high-tech future. He dropped in at a science center, where he was shown an electric go-cart and a wristband for diabetics that transmits a distress signal if it detects a cold sweat.
Later, he conducted a town-hall-style meeting with young people from around the region, in which he shared stories about his own political development and offered advice on how countries emerging from repression, like Myanmar, should deal with ethnic and religious strife.
As such societies open up, Mr. Obama said, conflicts inevitably bubble to the surface. He cited the legacy of ethnic strife in Malaysia, with its Muslim majority and Chinese and Indian minorities, and Myanmar, where the Rohingya minority currently faces persecution.
"Malaysia won't succeed if non-Muslims don't have opportunity," the president said at the forum, which was interrupted briefly by protesters holding up signs opposing the trans-Pacific trade deal. "Myanmar won't succeed if the Muslim population is repressed."
Malaysia has been tranquil for several years, in stark contrast to the tension during Mr. Gore's visit. Mr. Najib is a far less authoritarian figure than Mahathir Mohamed, the prime minister who dominated Malaysian politics for a quarter century, often railing against the United States.
More from the New York Times:
U.S. Weighs Harder Line on Russia Than European Allies
Recovery Has Created Far More Low-Wage Jobs
Two Popes Become Saints in Historic Canonizations
"President Obama and I are both equally concerned about civil liberties as a principle," Mr. Najib said. The case against Mr. Anwar, he insisted, was not a matter of the "government against him," but a complaint brought against him by a former employee.
Human rights activists credit Mr. Najib with reformist instincts early in his tenure. More recently, though, they say he has been pulled back from a moderate path by reactionary elements in the governing party.
But Mr. Obama has clearly developed a level of trust in the prime minister. After their meeting, the president went out of his way to express sympathy for the government's fruitless search for the Malaysian plane, which has also exposed Mr. Najib to criticism.
"Obviously, we don't know all the details of what happened," Mr. Obama said, "but we do know that if, in fact, the plane went down in the ocean in this part of the world, that is a big, big place."