The world has gotten another clear-eyed look at President Trump as he continues to rattle cages during his working vacation at his golf course in Bedminster, N.J. He has displayed one gear, one speed — attack and attack again.

When he is unhappy, it shows. This week his ire has been focused on two individuals — one an obvious adversary and the other, inexplicably, a presumed ally. The adversary is North Korea’s Kim Jong Un. The ally is Senate Majority Leader Mitch McConnell (R-Ky.).

Trump’s tweets and statements have escalated tensions between the United States and North Korea and seemingly put the president at odds, again, with some of his national security team on the best approach to a dangerous situation. But there may be a purpose behind all the bluster as his administration seeks to do what previous administrations have failed to do, which is to persuade the North Koreans to give up their quest to become a nuclear power.

His comments about McConnell are far more baffling. That McConnell has become a target for criticism is an unexpected and possibly destructive turn in Trump’s presidency. The tensions between the two leaders have existed since long before Trump was elected president. But neither Trump nor McConnell can afford to be at open war with one another. That, at least, is what McConnell allies believe.

After an ambiguous comment Thursday that left open whether he thinks McConnell should step down as leader, Trump resumed the attacks with more tweeting on Friday morning, making clear he thinks the strategy is working well.

(Jenny Starrs/The Washington Post)

Trump would say that McConnell started all this with what was a rather bland statement that the president perhaps had excessive expectations about the process of enacting legislation. That set the president off with a series of tweets and comments about the Senate leader. What Trump might regard as a little prodding from afar, however, others see as one more step outside the boundaries of what is considered presidential or politically wise.

Republican congressional leaders are certainly vulnerable to criticism. For seven years, they took the easy path, railing against the Affordable Care Act, promising to repeal it, voting scores of times to do so when there was no possibility that they would have to take responsibility for their actions. They reaped the political benefits of making Obamacare a political punching bag to rouse their conservative base. When it counted, when there was a president who would sign such a bill, they couldn’t deliver.

[An off-the-cuff president lets loose with reporters in Bedminster, N.J.]

Trump’s criticisms reflect long-standing frustrations with GOP leaders among grass-roots conservatives predating the 2016 election. The tea party eruption in 2009 and 2010, which put Republicans in control of Congress, produced a subsequent backlash among many of those voters, who came to regard GOP leaders in Washington as feckless and ineffective in power.

Trump can rightfully claim that one reason he was elected was because enough voters saw that ineffectiveness and blamed those in power — Democrats and Republicans — for inaction, gridlock and self-protection. The swamp he promised to drain is centered on Capitol Hill. He made that clear on Inauguration Day. With the political elite from Congress sitting behind him on the Capitol’s West Front, he lambasted lawmakers.

“For too long, a small group in our nation’s capital has reaped the rewards of government while the people have borne the cost,” he said that day. He added, “Politicians prospered — but the jobs left, and the factories closed. The establishment protected itself but not the citizens of our country.”

The president is far from blameless here. He bought into the “repeal and replace” mantra as a candidate, then did little to help in the effort to turn that promise into a legislative accomplishment. The Senate’s mangled effort collapsed when Sen. John McCain (R-Ariz.), long a Trump nemesis, voted no. Was that McConnell’s doing? Or was it a bit of payback by the Arizona senator to a president who questioned whether McCain deserved to be called a hero after being tortured and held captive in a North Vietnamese prison camp for more than five years?

Senate Majority Leader Mitch McConnell (R-Ky.) is seen during an all-night session to consider the Republican health-care bill on Capitol Hill last month. (Melina Mara/The Washington Post)

For a long time, House Speaker Paul D. Ryan (R-Wis.) was Trump’s preferred target. McConnell was often more shrewd than Ryan in handling the president’s outbursts. When he expressed displeasure with Trump, he did so in typically contained fashion. He generally kept his head down and his opinions to himself. He refused to be drawn too far into the fight.

[Trump attacks on McConnell bring rebukes from other Republicans]

But Ryan’s House succeeded where McConnell’s Senate failed. The House passed a health-care bill and the Senate did not. The president now seems to want a Senate do-over, another attempt to do what seems for now close to impossible. McConnell has no interest in going that route again, given the other issues awaiting Congress upon its return.

The president’s tweets suggest that he doesn’t understand the legislative branch and doesn’t particularly want to. His tweets at the time the health bill died in the Senate conveyed a misunderstanding of the rules. His tweets this week convey a lack of understanding of what faces Congress when lawmakers return in September — the debt limit and funding the government.

David Rohde, a professor of political science at Duke University, said the most plausible explanation of Trump’s decision to take on McConnell this week is an effort to play directly to his base. “For all the talk about fake polls, Trump and his collaborators must realize that their political support is deteriorating and that the possibility of a real political catastrophe 15 months from now is increasing,” he said in an email message.

Rohde went on to say this tactic by Trump might be the best of a bad set of options. “If they can maintain the base support, then Trump’s political fate will hinge on the hope of another asymmetric midterm turnout tilted in their favor,” he said. He added that he doubts this will be successful in any case.

However understandable Trump’s frustrations, he risks further erosion in his relationship with congressional Republicans by targeting McConnell. He got a taste of this a few weeks ago, when Republican senators rallied behind their former colleague, Attorney General Jeff Sessions, after the president began to hector Sessions the way he is hectoring McConnell this week.

[Trump retweets Fox headlines about ‘fallout’ for Republicans who cross him]

In a Trump-McConnell faceoff, lawmakers will side with the majority leader. When the president needs Republicans to take difficult votes on his behalf in the future, some may think twice. For some time, it has been apparent that members of Congress do not fear the president. Now the bonds of loyalty between Republicans on Capitol Hill and their president are being strained. Trump may need that loyalty in the months ahead, depending on the shape of special counsel Robert S. Mueller III’s investigation.

Trump acts as if being president puts him atop the entire government, and that from that perch he can issue commands and dictates that he expects others to follow. If he respects the constitutional checks and balances built into the system by the Founding Fathers, he is good at hiding it. The attack on McConnell may be only a passing summer storm. Or it could be something far worse for an embattled president.