President Trump on NATO: 'It's no longer obsolete' Trump bashed the defense alliance for months on the campaign trail.

 -- President Donald Trump reversed course on his view of the North Atlantic Treaty Organization on Wednesday, saying it is "no longer obsolete," after months of bashing the alliance as no longer relevant during his presidential campaign.

"I said it was obsolete. It's no longer obsolete," he said at a press conference with NATO Secretary General Jens Stoltenberg at the White House.

"The secretary general and I had a productive discussion about what more NATO can do in the fight against terrorism," Trump said. "I complained about that a long time ago, and they made a change, and now they do fight terrorism.

"Every generation strives to adapt the NATO alliance to meet the challenges of their times, and on my visit to Brussels this spring, which I look very much forward to, we will work together to do the same," he continued, calling for NATO to support Iraq to fight ISIS. "We must not be trapped by the tired thinking that so many have but apply new solutions to face new circumstances."

He reiterated that countries in NATO ought to allocate 2 percent of their GDP to military spending — a frequent rallying cry during his campaign last year. Only five of the 28 member states currently do so, including the U.S.

Trump said that NATO was obsolete as recently as January in an interview with The Times of London. "I said a long time ago that NATO had problems. No. 1, it was obsolete because it was designed many, many years ago. No. 2, the countries aren't paying what they're supposed to pay," he said. "I took such heat when I said NATO was obsolete. It's obsolete because it wasn't taking care of terror. I took a lot of heat for two days. And then they started saying Trump is right."

Vice President Mike Pence met with Stoltenberg shortly after that interview, reassuring the alliance that the U.S. will meet its treaty obligations if necessary.

Trump tweeted in March 2016 that the organization was obsolete because it did not focus enough on fighting terrorism.

NATO includes more than two dozen countries in North America and Europe, with the mission to "safeguard the freedom and security of its members through political and military means," according to the organization's website.

ABC's Elizabeth McLaughlin contributed to this report.