NEW DELHI — President Donald Trump should have been ready as he met with India’s prime minister, an unabashed hugger.

Smiling widely at a news conference Monday during a visit to Washington, Prime Minister Narendra Modi met the president’s outstretched arm not as an invitation for a handshake, but as a pull toward an embrace. Then he did it again in the White House Rose Garden. Then once more before leaving.

Trump appeared stiff and uncomfortable with the first hug, smiling thinly and patting Modi on the back a couple of times. But it was the same folksy, effusive greeting Modi has used with Trump’s predecessor, Barack Obama, and a host of foreign dignitaries and celebrities, from former French President Francois Hollande, Russian President Vladimir Putin and Japanese Prime Minister Shinzo Abe to Facebook CEO Mark Zuckerberg and Hollywood’s Hugh Jackman.

“Modi doesn’t hug just anyone,” said political scientist Sreeram Chaulia, dean of the Jindal School of International Affairs in New Delhi. “If you look at the list of people he’s hugged, these are people who matter for India’s interest.”

Leaders and celebrities should be prepared for Modi’s embrace by now, but they often aren’t — sometimes nearly getting knocked off balance. Much like Trump’s own see-saw style of shaking hands, analysts said the Modi hug has become a signature move, and is meant to be physical.

“Modi believes that trust can only be built through personal rapport and friendship, which includes positive body language and physical closeness with his counterparts,” Chaulia said. “He may have been trying to maintain the bromance that he had with Obama.”

There also may have been an element of relief in Modi’s hugs of Trump, launched at the end of a two-day visit described as “cordial” by Indian aides.

“Some people were worried about the outcome … in view of an unpredictable Trump,” retired Indian diplomat Rajeev Dogra said. “But he has gone out of his way to reach out to India.”

The fact that first lady Melania Trump was on hand, even though Modi was traveling without his wife, “was an important signal for India,” Dogra said.

Modi’s chummy overtures mark a stark change from years of being shunned by American officials because of religious violence in his home state of Gujarat. He had been denied a U.S. visa in 2005 over suspicions about his possible role in religious riots that killed more than 1,000 Muslims when he was Gujarat’s top official.

Since he became prime minister in 2014, he has visited the U.S. four times. But allegations of intolerance against Muslims and foreign-funded activists have dogged his Hindu nationalist party and government, which has been criticized for not speaking out against deadly attacks.

Indian strategic affairs experts hailed Modi’s latest visit as a success, but cautioned that much would depend on how words were translated into action on trade and even terrorism that India says is emanating from Pakistani soil.

“To all appearances, the chemistry seems to have been quite good between Trump and Modi,” said Rana Banerji, a retired intelligence officer in New Delhi. “At least President Trump did not do anything very unpredictable or seemingly unpalatable to the Indian side, though one doesn’t know what subsequently would emerge.”

India’s foreign ministry hailed the U.S. State Department’s move to list Pakistan-based Syed Salahuddin as a global terrorist for leading the Hizbul Mujahideen rebel group, which is fighting against Indian control in the divided Himalayan region of Kashmir.

The two countries also pledged to work together to try to end global terrorism, which India saw as a firm U.S. commitment to increase its involvement in the region.

There were clear signs of division, though: There was no mention of climate change, an issue of extreme concern in India, where many of the country’s 1.3 billion people are poor and vulnerable to extreme heat, drought and storm surges.

Trump also said little about the Asia-Pacific, though Modi made clear India’s intent to increase cooperation in the region as a check against China’s rising power.

It was only on the second day of Modi’s trip that he swooped in for his bear hugs. As the two gave a joint statement in the White House Rose Garden, Modi wrapped his arms around Trump’s midsection. The much shorter Modi, after giving his own remarks, hugged Trump a second time, placing his head close to the president’s shoulder in video that quickly spread on social media.

Trump treated Modi to dinner at the White House on Monday night and shared a laugh when he pointed to their social media dominance. Trump’s @realdonaldtrump Twitter handle has 32.8 million followers, while Modi’s Twitter game draws more than 31 million.

Trump also announced that daughter Ivanka Trump had accepted an invitation to visit India this fall. The president has business partners in India, where he has more than a dozen active deals, including a Trump-branded luxury apartment complex being built in the western city of Pune, near Mumbai.

Modi offered yet a third, public embrace as he departed the White House, resting his head first near Trump’s left shoulder, then near his right. By then Trump appeared to be ready, and welcomed the parting gesture by patting Modi kindly on the back.