President Trump speaks to a group of mayors in the East Room of the White House.

Jan. 24, 2018 President Trump speaks to a group of mayors in the East Room of the White House. Jabin Botsford/The Washington Post

A look at the second half of the president’s first year in the White House.

A look at the second half, so far, of the president’s first year in the White House.

A look at the second half, so far, of the president’s first year in the White House.

In the span of 48 hours this week, President Trump has boomeranged among three roles: the commander in chief, the divider and the uniter.

Like a contestant on one of his reality TV shows, Trump has taken on contrasting personas, showcasing divergent traits with flourishes seemingly to survive another day of his beleaguered presidency. Or, as Trump the television producer might put it, to keep up the ratings.

On Monday night at Fort Myer in Virginia, before hundreds of uniformed military members, he announced a new strategy for the war in Afghanistan with sobriety and seriousness. Reading from a teleprompter script, he ruminated about the gravity of his office and vowed to win a deeply unpopular conflict that, at 16 years, is the United States’ longest war.

The next day, Trump jetted to Phoenix, where the immigration inferno he has helped ignite burns nearly as hot as the broiling sun. Tuesday night’s “Make America Great Again” rally amounted to a relief valve for the pent-up grievances of a president under siege.

For 75 minutes, Trump ranted and roared his way through a fact-challenged, disjointed performance that, even by his own standards, could be considered epic. Speaking from the heart, he served up one “us” vs. “them” riff after another.

(Jenny Starrs/The Washington Post)

By “us,” he meant himself and the shrinking minority of mostly white Americans who fervently support him. By “them,” he meant everybody else — the news media (“damned dishonest”), Democrats (“obstructionists”), Arizona’s two Republican U.S. senators (“weak”), illegal immigrants (“animals”) and people in favor of removing Confederate monuments (“They’re trying to take away our culture. They are trying to take away our history”).

[As Trump ranted and rambled in Phoenix, his crowd slowly thinned]

By Wednesday, with television news commentators devouring his Phoenix free-for-all, Trump swooped into Reno, Nev., with the kind of unity message that you would expect to hear Pope Francis deliver.

“It is time to heal the wounds that divide us and to seek a new unity based on the common values that unite us,” Trump said, again reading from a teleprompter, at the national convention of the American Legion.

In Phoenix, Trump attacked — though not by name — one war hero, Sen. John McCain (R-Ariz.). But in Reno, he invited another, Medal of Honor recipient Donald Ballard, on stage for a warm embrace.

The whiplash from the three consecutive Trump speeches exemplifies the confusion and chaos that have come to define his presidency.

Is Trump trying to heal the wounds of a country torn over this month’s deadly white supremacist rally in Charlottesville? Or is he trying to pull it further apart?

President Trump delivered remarks to the American Legion in Reno, Nev., on Aug. 23, the day after a divisive campaign rally in Phoenix. (The Washington Post)

Did Trump act prudently to approve sending thousands of additional U.S. troops to Afghanistan after a deliberative, informed review of military options? Or is he an irrational and impulsive man with nuclear codes, as some watching the Phoenix rally concluded?

“Downright scary and disturbing” is how James R. Clapper Jr., a former director of national intelligence and retired Air Force lieutenant general, summed it up.

Clapper briefed Trump during the transition in his capacity as a top intelligence official in the Obama administration, and his assessment of Trump’s presidency has worsened in the months since. It seemed to reach a new low on Tuesday night.

“I really question his ability to be — his fitness to be — in this office,” Clapper said on CNN, where he is a contributor. “How much longer does the country have to, to borrow a phrase, endure this nightmare?”

Trump arrived in Phoenix nursing many wounds, most of his own making. Business executives, afraid of being associated with the president after his racially divisive comments about Charlottesville, resigned from White House advisory councils. Charities canceled planned galas at Mar-a-Lago, Trump’s private seaside resort in Palm Beach, Fla., for the same reason. Some prominent Republicans who enthusiastically supported his candidacy were now questioning Trump’s fitness for office.

“The president has not yet been able to demonstrate the stability nor some of the competence that he needs to demonstrate in order to be successful,” Sen. Bob Corker (R-Tenn.), the Senate Foreign Relations Committee chairman who had been considered a candidate for vice president and secretary of state, said last week.

Last weekend, as Trump wrapped up a two-week working vacation at his private golf club in Bedminster, N.J., he was in an especially sour mood, brooding in particular about the exodus from his beloved Mar-a-Lago, according to someone who spoke with him.

[‘When you put this guy in a cage and think you’re controlling him, things like this happen’]

These were only the most recent developments in a summer of crises for his administration that has sent his approval rating tumbling to historic lows.

The escalating investigations into his campaign’s possible role in Russia’s meddling in the 2016 election have enraged Trump, who maintains he is innocent and decries what he sees as a “witch hunt.”

But there are other factors feeding Trump’s discontent, including the denunciations in recent weeks — either implicitly or explicitly — by fellow Republicans, as well as Democrats in Congress, business leaders, uniformed military leaders, police officers and the Boy Scouts of America.

All the while, Trump’s new chief of staff, retired four-star Marine Corps general John F. Kelly, has sought to enforce discipline on the White House — including controlling the administration’s message, which is often set or reset by the president himself.

Trump long has chafed at attempts by his advisers to control him. He believes that he is his own best messenger and that the millions of Americans who elected him president want to hear his raw, unvarnished opinions — either in 140-character bursts on Twitter or at campaign rallies like the one he held in Phoenix.

Consider his many responses to Charlottesville. After Trump blamed the violence on “many sides” and declined to single out white supremacists in his initial statement on Aug. 12, his advisers persuaded him two days later to deliver scripted remarks from the Diplomatic Room of the White House. That is where the president calmly condemned “criminals and thugs, including the KKK, neo-Nazis, white supremacists and other hate groups that are repugnant to everything we hold dear as Americans.”

[Trump again blames ‘both sides’ for violence at white supremacist rally in Charlottesville]

The next day, however, Trump abandoned his message and offered a third response. At a free-wheeling news conference in the pink-marbled lobby of Trump Tower in New York, Trump declared that “both sides” were responsible for violence and that there were “very fine people” alongside the demonstrators brandishing Confederate battle flags and swastikas.

Again and again, the pattern has been the same. The moments when Trump stays on message — as with his Aug. 14 statement in the White House — almost inherently serve as a precursor for meltdowns, such as his news conference the next day.

In some ways, the Phoenix rally was an encore of his Trump Tower performance the previous Tuesday, a showcase of the core Trump — impassioned and indignant at the seven-month mark of his presidency.

Returning to the Phoenix Convention Center, where in July 2015 he held the first fiery mega-rally of his upstart campaign, Trump waxed about the good old days — back before he slandered the media as “fake news,” back when he had a love-hate-but-mostly-love relationship with the news outlets showering his candidacy with attention.

“The crowds were so big, almost as big as tonight, that the people said right at the beginning, ‘You know, there’s something special happening here,’ ” Trump said. “And we went to center stage almost from day one in the debates. We love those debates. We went to center stage, and we never left.”