JAKARTA, Indonesia — The tumultuous beginning of Donald Trump's presidency seems to have catapulted Indonesia into a highly awkward situation.

Officials in the country, traditionally an ally of the United States, have made apparently contradictory statements on Trump's new immigration policies, prompting some analysts to suggest that the government wants to signal its opposition to the rules without accidentally picking a fight with the unpredictable U.S. president.

Soon after the executive order banning or restricting travel from seven countries went into effect, Foreign Minister Retno Marsudi said that Indonesia, which is not among the seven, had “deep regrets about the policy.” Later, President Joko “Jokowi” Widodo said: “We are not affected by the policy. Why fret?” Johan Budi, his spokesman, said that Widodo had “made sure that the policy of the American president does not have an impact on Indonesian citizens. … Therefore, people are asked to remain quiet.”

Then on Thursday, at a news conference in Jakarta, Foreign Ministry spokesman Arrmanatha Nasir said Trump's policy was a “mistake” that could prove counterproductive, but also expressed confidence that the United States and Indonesia will nevertheless be cooperating more soon.

As the largest country in Southeast Asia — its 17,000 islands stretch across 735,358 square miles — Indonesia is at the center of potential conflicts between the United States and the region's rising power, China — especially tensions related to trade or the South China Sea. As a mostly Muslim country and a secular democracy, the country also walks a tightrope between its Western alliances and solidarity with the Islamic world. The explosive first weeks of the Trump administration have made that balance much more tenuous, and a slip could mean a shift away from the United States.

“The Widodo government is not likely to take a very assertive stance on the 'Muslim ban' for the time being,” said Christine Susanna Tjhin, a foreign policy researcher at the Center for Strategic and International Studies in Jakarta. Tjhin added that Widodo is typically nonconfrontational and that “a fight with Trump would not be regarded as productive.”

Among other possibilities, a U.S. escalation of tensions with China or a move to protectionism that would throw off the regional balance of power, Tjhin said.

“With Trump, his unpredictability and capacity to do or say anything is no longer a surprise,” she said. “Indonesia is really taking a cautious, wait-and-see approach.”

The Trump Organization has done business in Indonesia, the world's fourth-most-populous nation, and local tycoon Hary Tanoesoedibjo attended Trump's inauguration. Widodo publicly congratulated Trump on his victory.

But on the day that the Foreign Ministry's Nasir spoke, news broke that a disagreement had erupted out of nowhere between the United States and Australia, Indonesia's neighbor and ally. Because even friendly governments can inadvertently be drawn into public disputes, it's possible that Indonesian officials believe the best strategy is simply to try to avoid getting the new president's attention and hope to emerge unscathed.

Among Southeast Asian nations, Indonesia is more or less right in the middle of Chinese and U.S. spheres of influence, looking more often to Washington on security and increasingly to Beijing as a business partner, according to Natalie Sambhi, a research fellow at the Perth USAsia Center in Australia who studies Indonesia and geopolitics.

“Now there's a tension between wanting to work productively and enjoy a good relationship with the Trump administration and making sure to protect its identity as a Muslim country,” Sambhi said, adding that if Trump were to become really unpopular in Indonesia, it might be difficult for the government to make any progress in its relations with the United States.

Or maybe, despite its best efforts, Indonesia could become embroiled in a bizarre spat with Trump and hope to get through it, as countries as diverse as Germany, Japan and Australia are now doing.

“Hopefully, for example,” Sambhi said, “the future of the U.S.-Australian alliance won't be shaped by a single phone call.”