Japanese Prime Minister Shinzo Abe, leader of the Liberal Democratic Party (LDP), smiles as he puts a rosette on the name of a candidate who is expected to win the lower house election, at LDP’s headquarters in Tokyo on Sunday. (Kim Kyung-Hoon/Reuters)

Meet the international version of President Trump’s “adults in the room”: Shinzo Abe. On Sunday, the Japanese prime minister and his ruling Liberal Democratic Party roared to a major electoral victory in snap elections that he had called. Prospects were further boosted when Tokyo’s popular governor, Yuriko Koike, announced earlier that she had decided not to challenge Abe for the prime minister’s post.

Retaining a two-thirds supermajority in the lower house of the Diet, or Japan’s parliament, gives Abe the opportunity to rewrite Japan’s constitution, which, since it was imposed on Japan in 1947 by the United States, has committed Japan to the complete renunciation of war. Now, Abe wants to change the constitution to allow Japan’s Self-Defense Forces to fight in defense of Japan’s allies, such as the United States. In a sign of just how much things have changed in Asia, for decades the U.S. government was of two minds about whether Japan should revise its constitution. No longer.

Since Trump’s election, Abe has courted the American president, a marked contrast to European leaders who have scored political points by distancing themselves from the U.S. administration. Abe took a big political risk when he traveled to Trump Tower before the inauguration to huddle with the president-elect. Remember at the time that Abe and outgoing President Barack Obama had just concluded parallel visits — to Hiroshima in May 2016 and Pearl Harbor in December 2016 — that were fraught with political symbolism.

After the Trump Tower visit, Abe returned to the United States in February for a summit with Trump at Mar-a-Lago during which Abe and the rest of his team, faced with general chaos on the American side, staffed the meetings, set the agenda and organized a news conference afterward. In the middle of the summit, North Korea launched a missile and Trump and Abe were photographed discussing the affair over candlelight in the packed dining hall at Trump’s club. Since then, the two have spoken by phone more than a dozen times.

Two things appear to be driving Abe’s courtship of the American president. The first is that Japan, faced with a rising China and a belligerent North Korea (the state-run news agency recently branded Abe “a headless chicken”), still needs the United States as an ally and a trading partner. During the election campaign, Japan was spooked by Trump’s attack on U.S. alliances in Asia and his suggestion that perhaps Japan and South Korea should become nuclear powers and defend themselves. Instead of criticizing or cold-shouldering the president, Abe hugged him tighter. His diplomacy paid off when the two sides issued a joint communiqué in which the Trump administration again committed itself to the defense of the Senkaku Islands, which are also claimed by China.

Abe has also not given up on the Trans-Pacific Partnership, a trade deal involving 12 nations in the Asia-Pacific region that was negotiated by the Obama administration but that Trump rejected upon entering office. “Abe spent a lot of time in that golf cart at Mar-a-Lago telling Trump why TPP is important,” said Sheila Smith, an expert on Japanese politics at the Council on Foreign Relations. Abe’s government has continued to discuss the possibility of enacting a TPP minus the United States in the hope that the United States would ultimately join the pact.

A second reason for Abe’s determined diplomacy is that, as a leader, he appears to have matured. Abe’s grandfather, Nobusuke Kishi, was jailed for three years as a suspected war criminal after World War II, and Abe has written that he entered politics and embraced conservative causes in part to clear his family’s name. Abe’s attempts to battle with the past dominated his first tour as Japan’s prime minister in 2006. But he bombed and, citing health reasons, resigned after a year in office.

Abe returned to power in December 2012, chastened by his failure and less focused on trying to expunge Japanese guilt for World War II. “I see someone who has learned through hard experience and personal setbacks,” Smith said.

Abe has also learned that Japan had better not put all its eggs in the American basket. Trump is far from the only leader who has been subject to Abe’s version of a charm offensive. Abe has held a summit with Russia’s Vladimir Putin. He is close with India’s prime minister, Narendra Modi. He has tried to mend ties with China’s Xi Jinping, despite China’s reluctance to play ball. Since 2012, Abe has traveled to more than 50 countries, selling nuclear power in the Middle East, hawking high-speed rail to India and offering Japanese investment in Southeast Asia.

For decades, successive U.S. presidents have hectored their counterparts in Japan to emerge from America’s shadow and take more responsibility for their defense, for foreign affairs and for other important issues around the world. Now, spurred by the unpredictability of the Trump administration, Abe seems to be embracing American advice.