WASHINGTON — As a candidate, President Trump disparaged NATO as a musty relic of old thinking, an alliance focused on long-gone adversaries rather than new-era threats, a burden that drained American resources on behalf of ungrateful partners who did not pay their share. In a word: “obsolete.”

That was then. After 82 days in office, Mr. Trump officially pronounced NATO rehabilitated, taking credit for transforming it into a modern, cost-sharing, terrorism-fighting pillar of American and European security. “I said it was obsolete,” the president noted on Wednesday as he hosted NATO’s secretary general. “It’s no longer obsolete.”

Never mind that the alliance has changed very little if at all in the last three months, and that whatever modest changes have been made were in train long before Mr. Trump entered the doorway of the White House. After weeks of being lobbied, cajoled and educated by the leaders of Britain and Germany, not to mention “my generals,” as he likes to call his national security team, Mr. Trump has found fresh virtue in a venerable organization.

“Nothing has changed at NATO in the last 80 days,” said Ivo Daalder, a former ambassador to NATO under President Barack Obama and now president of the Chicago Council on Global Affairs. “It’s gratifying to see the president affirming that NATO is ‘no longer obsolete’ — it never was. Perhaps the one important thing that has changed in the last 80 days is that as president, Mr. Trump has come to appreciate the importance of this alliance and how it contributes to security and stability in Europe and beyond.”