JERUSALEM — Palestinians burned photos of President Trump in Gaza, and the walls of the Old City were illuminated with the American and Israeli flags on Wednesday, as Mr. Trump made good on his campaign pledge to recognize Jerusalem as Israel’s capital.

In a much-anticipated speech from the White House, Mr. Trump argued that it was “the right thing to do” to acknowledge the reality that Jerusalem is the seat of Israel’s government. Decades of avoiding that fact, he said, has done little to resolve the protracted feud between Israelis and Palestinians.

“It would be folly to assume that repeating the exact same formula would now produce a different or better result,” Mr. Trump declared. Recognizing Jerusalem as Israel’s capital, he said, is “a long overdue step to advance the peace process.”

Mr. Trump said that the United States still wanted a negotiated peace agreement — and “would support a two-state solution if agreed to by both sides” — and that he was not seeking to dictate the boundaries of Israeli sovereignty in the fiercely contested Holy City.