WASHINGTON — For a president prone to distraction, Donald Trump was unusually disciplined — for a time.

In the hours after the shooting of a Republican congressman and three other people in an Alexandria, Va., park, Trump behaved as most presidents do to reassure the nation in a moment of crisis: He called for unity in a scripted and sober television appearance from the White House, steered clear of attacking political opposition, and put the focus on the pain of the victims and heroism of law enforcement.

Then, at the end of the day Wednesday, as Trump sat down for dinner with his family to celebrate his 71st birthday, news broke that the special prosecutor in the Russia investigation was taking steps toward investigating Trump for possible obstruction of justice.

For hours, Trump again showed restraint as he and first lady Melania Trump delivered white flowers to the hospital for Rep. Steve Scalise, R-La., the congressional leader wounded in the gunfire.

“Just left hospital. Rep. Steve Scalise, one of the truly great people, is in very tough shape — but he is a real fighter. Pray for Steve!” Trump wrote on Twitter just before 10 p.m.

Trump’s restraint lasted nine more hours.

By early Thursday, Trump slipped back into his Twitter persona, returning to the fracas that aides have been trying to get him to avoid. Trump refused to let his outside counsel do the talking for him.

“They made up a phony collusion with the Russians story, found zero proof, so now they go for obstruction of justice on the phony story. Nice,” Trump tweeted before 7 am, a time when he is usually watching television news in his upstairs White House residence and getting ready for the day.

“You are witnessing the single greatest WITCH HUNT in American political history — led by some very bad and conflicted people!” he added an hour later.

The lure of speaking to 32 million followers on Twitter and fighting back against allegations Trump sees as fundamentally unfair may be too much to resist, even as advisers and Republican strategists warn that his provocative comments may be perpetuating the cycle of leaks and accusations that launched the investigation in the first place.

“He’s described himself as a counter-puncher. That muscle memory, that he has that reflex to react when something like this comes up, obviously it’s very strong,” said Jim Merrill, a New Hampshire-based consultant for three Republican presidential campaigns.

“Its safe to say that oftentimes the president can be his own worst enemy,” he said. “Certainly, weighing in on the investigation so quickly after the shooting yesterday kind of undermines the message of unity.”

Even after 146 days in the White House, Trump continues to seesaw back and forth between brief moments when his administration seems in control of the agenda and longer periods when outbursts from the president create overwhelming distractions.

By the middle of the day Thursday, Trump had returned to a more measured tone. He praised the two Capitol Police special agents — David Bailey and Crystal Griner — who ran toward the Illinois gunman in Wednesday’s shooting, saving lives, and described his visit to Scalise’s hospital room the night before, saying “he’s in some trouble” after a bullet tore through his hip.

After multiple surgeries Wednesday, Scalise’s doctors said the congressman had suffered from internal bleeding and organ damage and was still in critical condition.

“In these difficult hours, it’s more important than ever to help each other, care for each other and remind each other that we are all united by our love of our great and beautiful country,” Trump said at a signing ceremony Thursday for an executive order on jobs.

The White House seemed to acknowledge the dual nature of Trump’s give-and-take, but, at least officially, insisted that the two were not at cross purposes.

Asked why Trump took to Twitter to call investigators “very bad and conflicted people,” White House deputy press secretary Sarah Huckabee Sanders said the president was responding to allegations.

Meanwhile, Vice President Mike Pence has hired outside legal counsel to oversee his response to investigations into possible collusion between Russia and Trump’s 2016 campaign.

Pence’s office confirmed Thursday that he retained Richard Cullen, chairman of McGuireWoods LLP, to assist him in responding to inquiries by special counsel Robert Mueller.

Associated Press contributed.

brian.bennett@latimes.com