“That was not a State of the Union,” Ms. Pelosi said Thursday. “That was his state of mind.” She also said the president “looked to me like he was a little sedated” at the State of the Union, adding, “he looked that way last year too.”

Mr. Trump’s speech on Thursday morning was as overtly a political talk as any president has made at the National Prayer Breakfast, traditionally a bipartisan affair where members of both parties put aside their disagreements for an hour or two to focus on their shared beliefs. When he arrived, he held up two newspapers with banner headlines that said, “Acquitted” and “Trump Acquitted.” In addition to his outburst on impeachment, Mr. Trump cited rising stock markets, boasted about his approval rating in the latest Gallup poll and urged the audience to vote in the fall.

Mr. Trump’s remarks came hours before he plans to make a statement about the outcome of the impeachment trial at the White House at noon.

While Ms. Pelosi gave a short speech at the breakfast on behalf of the poor and persecuted, Mr. Trump seemed to glower and stared straight ahead, not looking at her. When it came time for him to speak, Mr. Trump immediately followed a keynote address by Arthur Brooks, a Harvard professor and prominent conservative thinker, who delivered a passionate plea to Americans to put aside hatred in national life and “love your enemies.”

At one point, Mr. Brooks asked the audience, “How many of you love somebody with whom you disagree politically?” Hands around the room shot up. “I’m going to round that off to 100 percent,” he said. But what he did not seem to notice was that Mr. Trump was among those who did not raise his hand.

“Contempt is ripping our country apart,” Mr. Brooks went on. “We’re like a couple on the rocks in this country.” Without mentioning Mr. Trump specifically, Mr. Brooks added: “Ask God to take political contempt from your heart. And sometimes when it’s too hard, ask God to help you fake it.”

Mr. Trump made no effort to fake it. While the rest of the room gave Mr. Brooks a standing ovation, he clapped politely but remained seated until finally rising at the end. “Arthur, I don’t know if I agree with you,” Mr. Trump said when he took the microphone. “I don’t know if Arthur is going to like what I’m going to say.”