For months, the White House has been stuck when it comes to replacing H.R. McMaster, the president’s national security adviser.

President Trump has often seemed eager to move on from the Army three-star general, who has struggled to bond with his irascible boss. And McMaster, who friends said has threatened to quit in fits of frustration and anger, has seemed eager to leave.

But efforts to move McMaster back to the Army have been stymied by two issues: Trump has had trouble finding a high-quality replacement who is willing and able to take over, and it is also not clear that McMaster, still an ­active-duty general officer, has any place to go in the Army.

The net result is one of the weaker National Security Councils in recent memory — a critical part of the White House that has struggled at times to corral powerful personalities in the Pentagon and State Department and advance the president’s often ill-defined foreign policy agenda.

McMaster has had an especially strained relationship with Defense Secretary Jim Mattis, a favorite of the president’s, who has been slow to respond to McMaster’s requests for military options to counter adversaries such as Iran and North Korea, officials said.

“He treats me like a three-star” rather than a coequal, McMaster has complained to colleagues of Mattis, a retired four-star Marine Corps general.

On Thursday, NBC News reported that the White House is preparing to replace McMaster as early as next month, the latest in a series of stories in recent weeks predicting the general’s departure.

One long-rumored candidate to become Trump’s third national security adviser is Stephen ­Biegun, an auto-industry executive who worked in the George W. Bush administration but is not well known in foreign policy circles, according to the officials, who spoke on the condition of anonymity to discuss internal deliberations. Biegun, who colleagues say is a steady manager and centrist, shares the president’s skepticism of big global trade deals.

White House officials insisted that no move to replace McMaster is imminent. “I was just with President Trump and H.R. McMaster in the Oval Office,” said Michael Anton, a spokesman for the NSC. “President Trump said that the NBC News story is ‘fake news’ and told McMaster that he is doing a great job.”

White House Chief of Staff John F. Kelly privately told colleagues Thursday that he did not know Biegun, who was reported by NBC to have Mattis’s backing and to be a front-runner for the position.

A national security adviser’s influence is often dependent on having a close relationship with the president. But few in Washington see McMaster as speaking for Trump

In late February, McMaster said there was ‘‘incontrovertible’’ evidence of a Russian plot to disrupt the 2016 U.S. election. The remark drew a quick and public rebuke from the president via Twitter.

“General McMaster forgot to say that the results of the 2016 election were not impacted or changed by the Russians,” Trump wrote. “The only Collusion was between Russia and Crooked H...”

It is widely known that Trump has often grown frustrated with McMaster during meetings, complaining that he drones on too long and can be too rigid in his thinking. This summer, at a low point in their relationship, McMaster entered the Oval Office only to have Trump complain that he had already seen him that day.

McMaster reminded the president that he often needed to brief him on fast-moving events.

At the time, McMaster was pushing Trump to send additional U.S. troops to Afghanistan to reverse the course of what appeared to be a losing war. In meetings on the proposed troop surge, Trump berated McMaster and even Mattis as lacking in creative thinking. After months of deliberation, he signed off on an increase.

Since then, McMaster’s relationship with Trump has stabilized, even as rumors of his imminent departure have swirled.

In the White House, McMaster is credited with bringing order to a National Security Council that was overwhelmed by chaos and sinking morale after the firing of Michael Flynn, Trump’s first national security adviser. McMaster is currently overseeing some of the most sensitive issues facing the White House, such as efforts to counter Iran’s expanding role in the Middle East and the administration’s strategy to roll back North Korea’s nuclear weapons program.

McMaster has told fellow Army officers that he is honored to work on some of the most important issues facing the country, but he can be quick to show the strains of the job. Mattis and Secretary of State Rex Tillerson often dominate meetings chaired by McMaster. In an unusual move, the three have agreed to hold only one meeting a week of the president’s top national security advisers.

Barring emergencies, the agenda for the gathering must be set 72 hours in advance. The strictures have made it hard for McMaster to coordinate policy and develop options for the president, officials said.

“He often gets frustrated, goes through a phase, and his peer support group pulls him out of a funk,” one senior administration official said. “I was convinced several times that this was it for his departure. Hasn’t happened. I think he deep down cares too much.”

Other officials said McMaster has stormed out of the West Wing or threatened to quit in front of his staff, only to calm down a few hours later.

“My personal feelings is that he’s too passionate and only going if he’s told to go,” the official said. “At least right now.”

Ideally, the White House would like to promote McMaster to a four-star position, officials said. But a senior Army official, who tracks general officer personnel moves, said he has received no indication from the White House that McMaster will be returning to the Army anytime soon.

The military typically plans four-star promotions months in advance.

Trump and other senior White House officials recognize that it would be an important milestone if McMaster were promoted to a fourth star and returned to the Army.

“Not many people have served in this administration and emerged unscathed,” said a person familiar with White House deliberations regarding McMaster. “They need to show you can serve in this administration and survive.”