UNITED NATIONS — President Donald Trump said Tuesday that NATO countries should shoot down Russian military aircraft that enter their airspace. But asked if the United States would back up its allies in that situation, he said it “depends on the circumstance.”

The president’s comments came in a news conference before a bilateral meeting with Ukrainian President Volodymyr Zelenskyy at the United Nations General Assembly in New York, and as Russian jets and drones have appeared to test NATO’s defenses in recent weeks by venturing into the skies over Poland, Romania and Estonia.

Earlier, Trump gave a long address in which he criticized the international body as ineffective and lectured its member nations on how they are failing in his opinion.

During his speech, Trump also boasted about his own record and sought to portray himself as the only leader who could solve the world’s problems.

“I’m really good at this stuff,” he said. “Your countries are going to hell.”

As the General Assembly convened on its 80th anniversary with wars raging in the Gaza Strip, Sudan and Ukraine, Trump at one point questioned whether the U.N. served a purpose. He claimed that he had resolved conflicts around the world while the U.N. had done nothing.

“Sadly, in all cases, the United Nations did not even try to help in any of them,” Trump said.

But he also frequently veered off script. He warned darkly of a “double-headed monster” of illegal migration and a shift to renewable energy, and called climate change the “greatest con job” ever perpetrated on the world. He accused environmentalists of wanting to “kill all the cows,” personally insulted the Muslim mayor of London and falsely claimed that Muslims in the West are planning to institute Shariah law.

While taking credit for ending conflicts between Israel and Iran, Cambodia and Thailand, and Armenia and Azerbaijan, Trump again blamed his predecessor, Joe Biden, for Russia’s decision to invade Ukraine, a frozen war that has proved intractable.

He also said China and India were financing the Ukraine war because they purchase oil from Russia. He said he was ready to impose more tariffs on Russia and its oil customers if Moscow does not agree to a ceasefire, but he would do so only if Europe also ends all purchases of Russian oil and gas.

Later, appearing with Zelenskyy, Trump called the Ukrainian leader a brave man and said the United States has “great respect for the fight that Ukraine is putting up.” This was in stark contrast to a contentious meeting in the Oval Office in February, when Trump castigated the wartime leader in a fiery exchange.

For his part, Zelenskyy said he looked forward to talking about Trump’s proposal to stop Russian oil sales to Europe.

Among the highlights:

In his welcoming speech, U.N. Secretary-General António Guterres warned about the dangerously chaotic state of the world while providing a measure of hope that unity and diplomacy can bring stability. “People everywhere are demanding something better, and we owe them something deserving of their trust,” Guterres said. He also touched upon climate change, something he has made a priority for his legacy, only to have Trump deride it as a “hoax” minutes later.

Brazilian President Luiz Inácio Lula da Silva gave a scathing opening address that appeared to take aim at Trump’s steep tariffs against Brazil and his demands to halt Brazil’s criminal prosecution of former President Jair Bolsonaro, a Trump ally. Later, the U.S. president appeared to offer an olive branch, signaling that he planned to meet with Lula next week.

In his speech, Trump targeted other political opponents and close NATO allies that have recognized a Palestinian state as part of an effort to push forward the long-delayed “two-state” solution. He said a two-state solution would be a victory for Hamas and those nations should demand the Israeli hostages in Gaza be released. He did not mention Israel’s efforts to take Gaza City or his past promises to get more food and aid to the enclave. Israel’s blockade of aid to the enclave amid a growing humanitarian crisis has drawn accusations of genocide.

The U.N. Security Council will convene back-to-back sessions on the wars in Gaza and Ukraine on Tuesday afternoon, with many foreign ministers in attendance. The council has not acted in either conflict, blocked by the veto power of Russia in the case of Ukraine and of the United States in support of Israel.