Taking ownership of a shutdown was considered verboten in Washington and the overwhelming consensus was that the president had screwed up.

But Trump was elated with the media coverage that followed.

“This is why I was so great on the Apprentice,” he told a startled Speaker Paul D. Ryan (R-Wis.) during a phone call the next morning, crowing that the ratings of the meeting were “great.”

Ryan said he did not know such government meetings scored ratings — or that they were released within 12 hours, according to aides familiar with the call who requested anonymity to describe the private conversation. Trump told Ryan that everyone watched and that Trump was dominating the TV — and that made the meeting a success.