WASHINGTON — President-elect Donald Trump inherited a complicated world when he won the election last month. And that was before a series of freewheeling phone calls with foreign leaders that has unnerved diplomats at home and abroad.

In the calls, he voiced admiration for one of the world's most durable despots, the president of Kazakhstan, and said he hoped to visit a country, Pakistan, that President Barack Obama has steered clear of during nearly eight years in office.

Trump told the British prime minister, Theresa May, "If you travel to the U.S., you should let me know," an offhand invitation that came only after he spoke to nine other leaders. He later compounded it by saying on Twitter that Britain should name the anti-immigrant leader Nigel Farage its ambassador to Washington, a startling break with diplomatic protocol.

Trump's unfiltered exchanges have drawn international attention since the election, most notably when he met Prime Minister Shinzo Abe of Japan with only one other American in the room, his daughter Ivanka Trump — dispensing with the usual practice of using State Department-approved talking points.

On Thursday, the White House weighed in with an offer of professional help. The press secretary, Josh Earnest, urged the president-elect to make use of the State Department's policymakers and diplomats in planning and conducting his encounters with foreign leaders.

"President Obama benefited enormously from the advice and expertise that's been shared by those who serve at the State Department," Earnest said. "I'm confident that as President-elect Trump takes office, those same State Department employees will stand ready to offer him advice as he conducts the business of the United States overseas."

"Hopefully he'll take it," he added.

A spokesman for the State Department, John Kirby, said the department was "helping facilitate and support calls as requested." But he declined to give details, and it was not clear to what extent Trump was availing himself of the nation's diplomats.

Trump's conversation with Prime Minister Nawaz Sharif of Pakistan has generated the most angst, because, as Earnest put it, the relationship between Sharif's country and the United States is "quite complicated," with disputes over issues ranging from counterterrorism to nuclear proliferation.

In a remarkably candid readout of the phone call, the Pakistani government said Trump had told Sharif that he was "a terrific guy" who made him feel as though "I'm talking to a person I have known for long." He described Pakistanis as "one of the most intelligent people." When Sharif invited him to visit Pakistan, the president-elect replied that he would "love to come to a fantastic country, fantastic place of fantastic people."

The Trump transition office, in its more circumspect readout, said only that Trump and Sharif "had a productive conversation about how the United States and Pakistan will have a strong working relationship in the future." It did not confirm or deny the Pakistani account of Trump's remarks.

The breezy tone of the readout left diplomats in Washington slack-jawed, with some initially assuming it was a parody. In particular, they zeroed in on Trump's offer to Sharif "to play any role you want me to play to address and find solutions to the country's problems."

That was interpreted by some in India as an offer by the U.S. to mediate Pakistan's border dispute with India in Kashmir, something that the Pakistanis have long sought and that India has long resisted.

"By taking such a cavalier attitude to these calls, he's encouraging people not to take him seriously," said Daniel F. Feldman, a former special representative to Afghanistan and Pakistan. "He's made himself not only a bull in a china shop, but a bull in a nuclear china shop."

Husain Haqqani, a former Pakistani ambassador to Washington, said his government's decision to release a rough transcript of Trump's remarks was a breach of protocol that demonstrated how easily Pakistani leaders misread signals from their American counterparts.

"Pakistan is one country where knowing history and details matters most," Haqqani said, "and where the U.S. cannot afford to give wrong signals, given the history of misunderstandings."

At one level, Trump's warm sentiments were surprising, given that during the campaign, he called for temporarily barring Muslims from entering the United States to avoid importing would-be terrorists.

His conversation with Sharif also came a day after an attack at Ohio State University in which a Somali-born student, Abdul Razak Ali Artan, rammed a car into a group of pedestrians and slashed several people with a knife before being shot and killed by the police. Law enforcement officials said Artan, whom the Islamic State has claimed as a "soldier," had lived in Pakistan for seven years before coming to the United States in 2014.

Obama never visited Pakistan as president, even though he had a circle of Pakistani friends in college and spoke fondly of the country. The White House weighed a visit at various times but always decided against it, according to officials, because of security concerns or because it would be perceived as rewarding Pakistani leaders for what many U.S. officials said was their lack of help in fighting terrorism.

"It sends a powerful message to the people of a country when the president of the United States goes to visit," Earnest said. "That's true whether it's some of our closest allies, or that's also true if it's a country like Pakistan, with whom our relationship is somewhat more complicated."

Trump's call with President Nursultan A. Nazarbayev of Kazakhstan raised similar questions.

Nazarbayev has ruled his country with an iron hand since 1989, first as head of the Communist Party and later as president, after Kazakhstan won its independence from the Soviet Union.

In April 2015, he won a fifth term, winning 97.7 percent of the vote and raising suspicions of fraud. "I apologize if these numbers are unacceptable for the super-democratic countries, but there was nothing I could do," he said after the results were announced.

The Kazakh government, in its account of Trump's conversation, said he had lavished praise on the president for his leadership of the country over the last 25 years.

"D. Trump stressed that under the leadership of Nursultan Nazarbayev our country over the years of independence had achieved fantastic success that can be called a 'miracle,'" it said.

The statement went on to say that Trump had shown solidarity with the Kazakh government over its decision to voluntarily surrender the nuclear arsenal it inherited from the Soviets.

"There is no more important issue than the nuclear disarmament and nonproliferation, which must be addressed in a global context," it quoted Trump as saying.