NATO flags flutter during the final day of NATO Saber Strike exercises in Orzysz, Poland, June 16, 2017. REUTERS/Ints Kalnins

WASHINGTON (Reuters) - The U.S. House of Representatives voted nearly unanimously on Tuesday to reaffirm the NATO alliance’s guarantee that all members defend each other, weeks after President Donald Trump raised doubts about Washington’s support for the agreement.

The vote was 423-4 in the House, where Trump’s fellow Republicans hold a 48-seat majority, for a resolution “solemnly reaffirming” the U.S. commitment to Article 5 of the North Atlantic Treaty.

It also supports calls for every NATO member to spend at least 2 percent of its gross domestic product on defense by 2024.

During a visit to NATO headquarters in Brussels in May that was part of his first overseas trip, Trump pointedly did not mention U.S. support for that critical portion of the NATO charter, rattling allies. Instead, he used a speech there to demand that member states pay more for the alliance’s defense.

Trump later said he backed the mutual defense agreement, and other senior officials rushed to express U.S. support.

“With all the threats we and our partners face around the globe, a strong and secure NATO is more important than ever before,” Republican House Speaker Paul Ryan said in a statement.

The resolution was co-sponsored by Ryan and House Democratic Leader Nancy Pelosi, as well as the number two Republican and Democrat in the chamber, and the Republican chairman and the ranking Democrat on the House Foreign Affairs Committee.