President Biden and President Joko Widodo of Indonesia met at the White House on Monday to announce a new strategic partnership, but their differing views on the conflict in Gaza came into view when Mr. Joko asked for the United States to “do more” to stop the war.

Mr. Joko, who arrived in Washington fresh from a summit in Saudi Arabia where he condemned the war, has been vocal in criticizing Israel’s role. After Mr. Biden welcomed him to the Oval Office by celebrating a “new era of relations between the United States and Indonesia,” Mr. Joko ended his own set of remarks by calling for an end to the conflict.

“Indonesia also wishes our partnership contributes to regional and global peace and prosperity,” Mr. Joko said. “So Indonesia appeals to the U.S. to do more to stop the atrocities in Gaza. Cease-fire is a must for the sake of humanity.”

Mr. Biden, whose administration had said a cease-fire would only benefit Hamas, did not respond. On Monday, Mr. Biden and other officials called for the protection of hospitals in Gaza from attack.

Mr. Joko, whose country is home to the largest Muslim population in the world, has blamed Israel for an attack on the Al-Ahli Arab Hospital in Gaza City in October. American intelligence agencies say they have high confidence that the blast was caused by a Palestinian rocket. Mr. Joko is the first leader from a Muslim-majority country to visit the White House since the war began.

A senior administration official who previewed the summit for reporters on Sunday evening said that Indonesia’s view of the war was important to the White House and that Mr. Biden would “listen carefully” to Mr. Joko during their meeting. John F. Kirby, a White House spokesman, told reporters last week that the president would “make it clear that the United States stands with Israel.”

In recent weeks, tens of thousands of people have gathered in the streets of Jakarta, Indonesia, to call for a cease-fire in Gaza. Indonesia does not have formal diplomatic ties with Israel, and human rights groups had pressured Mr. Joko to ask Mr. Biden to call for a cease-fire.

Mr. Biden’s advisers are hopeful that a new strategic partnership with Indonesia can withstand tension over Gaza. The partnership bolsters the president’s efforts to draw countries in the Indo-Pacific closer to the United States as concerns grow over China’s aggression in the region.

Indonesia matters to the United States in part because of its sheer size. With around 280 million people, it is the world’s fourth most populous country. It is abundant in resources — it is the world’s biggest nickel producer — and has a fast-growing, trillion-dollar economy. Its policies on climate change and the environment affect the world, though critics have said its quest to increase nickel production comes at the cost of substantial greenhouse gas emissions.

(When Mr. Biden traveled to Indonesia for the Group of 20 summit a year ago, Mr. Joko gave both the president and reporters a tour of a mangrove farm in Bali and trumpeted their ability to clear the air and combat climate change.)

The country is also seen as pivotal in the geopolitical battle between Washington and Beijing. China has cultivated much closer ties with Indonesia under Mr. Joko.

The announcement of the partnership, which came two days before Mr. Biden is scheduled to meet with President Xi Jinping of China at a highly choreographed summit in San Francisco, places the United States on the same diplomatic footing as Beijing, which announced a comprehensive relationship with Jakarta in 2013. Mr. Biden and his advisers consider the new pact to be evidence that concern over China has made leaders in the region more interested in teaming up with the United States than they once were.

Mr. Joko likes to say he remains independent of either country’s influence. But he has shown a special affinity for Mr. Xi and has traveled to China five times throughout his time in office. China was the second-largest investor in Indonesia, after Singapore, in 2022.

In September, China’s premier, Li Qiang, pledged $21.7 billion in new Chinese investment in Indonesia to strengthen the countries’ economic and political ties. Mr. Joko, whose term ends next year, considers infrastructure a signature legacy, and he has turned to China to help him achieve his goals.

But Mr. Joko realizes that Indonesia needs to find a hedge. Chinese investments in the country have led to discontent, and he also knows that Indonesia needs to diversify foreign investment. One of the top priorities on his agenda is reaching an agreement with the United States over supplies of the critical minerals used to make car batteries.

Indonesia wants to generate greater demand for its nickel by making it eligible for the American tax credits under the Inflation Reduction Act. Companies would then be more interested in building smelters and electric vehicle factories in Indonesia, creating jobs.

The country wants the kind of preferential access that was granted this year to Japan, either through an independent deal or as part of a limited free trade agreement. But some U.S. officials have expressed concern about Indonesia’s problematic environmental and human rights records, especially when it comes to nickel mining. Any deal is likely to run up against opposition in Congress.

Peter Baker contributed reporting from Washington.