An argument last February between the White House chief of staff, John F. Kelly, and Corey Lewandowski, an informal adviser to President Trump, turned into a physical altercation that required Secret Service intervention just outside the Oval Office, according to a half-dozen people familiar with the events.

The episode, details of which have not been previously reported, is the latest illustration of the often chaotic atmosphere Mr. Trump is willing to tolerate in the White House as well as a reflection of the degree to which Mr. Kelly’s temper can be provoked.

The near brawl — during which Mr. Kelly grabbed Mr. Lewandowski by the collar and tried to have him ejected from the West Wing — came at a time when the chief of staff was facing uncertainty about how long Mr. Trump would keep him in his job. A guessing game over his departure has colored his tenure ever since.

Mr. Kelly, a retired four-star Marine Corps general, was widely hailed as the lone grown-up who could corral a staff full of bombastic and competing personalities when he was appointed in summer 2017. But Mr. Kelly has shown little inclination to curb his own instinct for confrontation, from scuffling with a Chinese official during a visit to Beijing last year to last week’s profanity-laced shouting match with John R. Bolton, the national security adviser, after a meeting with the president.

White House officials declined to comment for this article. Mr. Lewandowski did not respond to multiple requests for comment.

But the altercation on Feb. 21 was among the ugliest known to have taken place in a West Wing that has been characterized by constant drama and heated skirmishes — all forms of behavior that the president has long tolerated among his aides.

Anthony Scaramucci, who has written a book about being Mr. Trump’s communications director for 11 days until Mr. Kelly fired him after the release of a recording of his own profanity-laced call with a reporter, said on NBC’s “Meet the Press” on Sunday that Mr. Kelly had “hurt the morale inside the place.”

“And he’s hurt the president. And he has hissy fits,” Mr. Scaramucci said, adding that “he’s demonstrating his personality now the way he really is.”

Mr. Kelly’s defenders argue that he has been effective at ridding the White House of problematic personalities, such as Omarosa Manigault Newman, and that he has put in place a degree of order that did not exist before his arrival, despite the challenges of the work environment that Mr. Trump creates. And a person who witnessed the exchange between Mr. Kelly and Mr. Bolton last week insisted there was never a shouting match as described in many accounts.

Leon Panetta, the former defense secretary, defended Mr. Kelly, who served as his senior military assistant when he was at the Pentagon, as a “fine person” and a “good Marine” who would “walk off a cliff” for people who earned his loyalty.

But, Mr. Panetta said, “there’s no question that the level of frustration must be rising if he’s getting into shouting matches and starting to really take on other people.”

On the day Mr. Kelly grabbed Mr. Lewandowski, families of the shooting victims from Marjory Stoneman Douglas High School in Parkland, Fla., were streaming into the White House for an event with the president in the East Room. Mr. Trump had both men in his office, according to those briefed on the event. Mr. Lewandowski, the president’s first campaign manager, was there for a previously scheduled appointment.

Mr. Kelly criticized Mr. Lewandowski to Mr. Trump for making so much money off the president in the form of his contract with the super PAC supporting the president’s re-election. Mr. Kelly also expressed his anger that Mr. Lewandowski had been criticizing him on television for his handling of the security clearance controversy related to Mr. Porter.

Image

West Wing aides now try to make sure Corey Lewandowski, President Trump’s former campaign manager, steers clear of Mr. Kelly’s corner.CreditAl Drago for The New York Times

At some point, Mr. Trump took a phone call, and both men left the room, those briefed on the episode said.

As Mr. Kelly walked toward a hallway leading back to his office, he called to someone to remove Mr. Lewandowski from the building. The two then began arguing, with Mr. Lewandowski speaking loudly. Mr. Kelly grabbed Mr. Lewandowski by his collar, trying to push him against a wall, according to a person with direct knowledge of the episode.

Mr. Lewandowski did not get physical in response, according to multiple people familiar with the episode. But Secret Service agents were called in. Ultimately, the two men agreed to move on, those briefed on the episode said.

Still, people in the West Wing who learned at the time what had happened were stunned.

In the months since the altercation, Mr. Lewandowski has traveled frequently with Mr. Trump aboard Air Force One to his political rallies and has continued to meet frequently with the president in the White House, though West Wing aides now try to make sure he steers clear of Mr. Kelly’s corner of the West Wing.

He is also writing a book, “Trump’s Enemies: How the Deep State Is Undermining the Presidency,” which is scheduled to be published in the weeks after the election and which some in Mr. Trump’s circle fear will take swipes at some of his aides.

On the other hand, Mr. Kelly, who is called “the general” or “the chief” by his allies inside the West Wing, is widely seen as a diminished presence among the president’s advisers. Though Mr. Kelly has repeatedly said he expresses his honest opinions to Mr. Trump, he has shown little inclination or ability to curb some of the president’s impulses.

He is not the first chief of staff to struggle with his image inside and outside the White House: Administration observers compare Mr. Kelly to Donald T. Regan, President Reagan’s former chief of staff, who amassed power in the West Wing only to squander it in clashes with other advisers and the president’s wife.

With his legacy in mind, Mr. Kelly tends carefully to his press coverage, and keeps his eye on those he considers to be friendly to him in print and on the broader White House staff, according to multiple current and former aides. The president, who publicly maintains that his West Wing runs like a well-oiled machine, recently invited a reporter for New York magazine — along with his vice president, secretary of state and Mr. Kelly — into the Oval Office to show just how much faith he has in his chief of staff.

“There is, to the best of my knowledge, no chaos in this building,” Mr. Kelly said during that interview. “We’ve gotten rid of a few bad actors, but everyone works very, very well together.”

In July, Mr. Kelly told aides that Mr. Trump had asked him to stay on in his role until 2020, but reports of his conflicts with other staff members have continually raised questions about how long he will last. Even Mr. Trump has privately indicated to people that he was skeptical that Mr. Kelly would remain that long.

“I think John does this out of loyalty to the country,” Mr. Panetta said, “and the hope that, somehow, for all of the difficulty that he’s confronting, that somehow he’s serving a purpose.”

The president, for his part, has shown a certain reverence for men willing to engage in physical scuffles. Last fall, when Mr. Kelly was newly in his role, his willingness to engage angrily in meetings with Lt. Gen. H. R. McMaster, who at the time was the national security adviser, thrilled Mr. Trump. The president, who did not like General McMaster, gleefully told people about the skirmishes between the two men for weeks, saying it showed how tough Mr. Kelly was, a person familiar with the discussions said.

But recently, Mr. Kelly has gone from enjoying Mr. Trump’s public praise — “He has been a true star of my Administration,” the president said of Mr. Kelly last summer — to someone often sidelined by a president who believes he is his own best chief of staff.

Mr. Kelly, meanwhile, has chosen to stay in the role despite Mr. Trump’s clear interest in keeping Mr. Lewandowski around in some fashion.

“I think Trump has decided it’s really a bad marriage,” said Chris Whipple, author of “The Gatekeepers,” a history of White House chiefs of staff, “that he has decided to muddle through.”

A version of this article appears in print on , on Page A11 of the New York edition with the headline: The Day the West Wing Boiled Over Just Steps From the Oval Office. Order Reprints | Today’s Paper | Subscribe