After a top NASA official improperly contacted a senior Boeing executive about a bid to win a contract potentially worth hundreds of millions of dollars, the company attempted to amend its proposal past the deadline for doing so, according to people with knowledge of the matter.

That raised alarm bells inside the space agency, where officials were concerned that Boeing was attempting to take advantage of inside information. Ultimately, the matter was referred to NASA’s inspector general office, and NASA’s leadership last month forced Doug Loverro to resign from his position as the associate administrator of NASA’s human spaceflight directorate.

Boeing did not win one of the lucrative contracts to build a system capable of landing astronauts on the moon. But the inspector general investigation could be another headache for a company under fire for having an unusually cozy relationship with federal regulators, especially if it identifies wrongdoing on the part of Boeing senior executives. The company already is reeling from two fatal crashes of its 737 Max airplanes that killed a total of 346 people and from the bungled test flight in December of its Starliner space capsule.

A person with direct knowledge of the matter who spoke on the condition of anonymity because of the ongoing investigation said: “I can tell you with 100 percent confidence that no laws were broken. What we are talking about are conversations that occurred outside the normal dictated channels but didn’t violate the sanctity of the procurement process.”

The conversation at the root of the investigation was between Loverro and Jim Chilton, the senior vice president of Boeing’s space and launch division, putting one of the company’s top executives in the middle of the probe, according to multiple people familiar with what took place.

The investigation into Loverro’s interactions with Boeing was first reported by the Wall Street Journal. But Chilton’s involvement and Boeing’s actions after Loverro spoke with him had not previously been known.

The probe is separate from a previously announced audit into NASA’s acquisition strategy for the program, called Artemis, to return to the moon. After its investigations, which can take months, the inspector general refers findings either to the Justice Department for prosecution or to NASA’s leadership for administrative action.

The inspector general declined to comment, as did Boeing. Chilton also declined to comment.

NASA officials have stressed that the agency has gone to great lengths to ensure the integrity of the contract awards, worth $1 billion combined, that went to teams led by Jeff Bezos’s Blue Origin and Dynetics, as well as Elon Musk’s SpaceX. (Bezos owns The Washington Post.)

In his resignation letter, Loverro, a longtime public servant who spent many years at the Pentagon before coming to NASA, wrote that he took “a risk earlier in the year because I judged it necessary to fulfill our mission. Now, over the balance of time, it is clear that I made a mistake in that choice for which I alone must bear the consequences.”

In an interview with The Post last month, Loverro said he was trying to speed up the Artemis moon program to meet a White House mandate to return astronauts to the lunar surface by 2024.

“It had to do with moving fast on Artemis, and I don’t want to characterize it in any more detail than that,” he said.

Loverro declined to comment on the record for this story.

According to a congressional aide with knowledge of the matter, NASA procurement officials grew concerned earlier this year when Boeing contacted the agency, saying it wanted to change parts of its bid for the lunar lander contract. Not only was it late in the process, but the specificity of Boeing’s proposed changes raised “red flags” inside NASA that the company had received inside information improperly.

NASA officials wondered, “How did they know to raise this issue or try to fix this issue?” according to the aide, who spoke on the condition of anonymity because of the ongoing investigation.

Once it became aware of Loverro’s actions, NASA’s leadership moved quickly, officials said, forcing him out, even though the timing was terrible — coming just days before the first launch of NASA astronauts from United States soil in nearly a decade.

But the probe is also focusing on Boeing, officials said.

“This certainly goes both ways. It’s one thing to have a mistake that violated the Integrity in Procurement Act,” the aide said. “It’s another if the company took that information and acted on it.”

The investigation comes as Boeing continues to face fallout over its handling of the two 737 Max crashes. Boeing has been accused of downplaying the dangers and having a too cozy relationship with regulators at the Federal Aviation Administration. A congressional report released this year accused Boeing of having a “culture of concealment.”

Its space program has also taken a hit. The company has been under fire for the performance of its Space Launch System rocket, which is years behind schedule and billions over budget. Its Starliner spacecraft, designed to fly astronauts to the International Space Station, suffered problems during a test flight without crews on board last year, forcing the company to schedule to re-fly the mission at a cost of $410 million. That retest is likely to come later this year.

On April 30, NASA awarded three contracts for the Human Landing System (HLS), worth nearly $1 billion combined, to three companies to build landing systems capable to taking astronauts to the lunar surface.

A team led by Bezos’s Blue Origin that includes Lockheed Martin, Northrop Grumman and Draper won the largest award, $579 million. Longtime NASA contractor Dynetics, which paired with the Sierra Nevada Corp., received a $253 million contract. Musk’s SpaceX won $135 million.

Federal procurement regulations encourage the government to communicate with contractors about their bids to help agencies get the products and services that best fit their requirements.

“The question becomes when is it okay to have those discussions, and more importantly, whether you have to have the exact same discussions with all potential bidders,” said David Berteau, the president and chief executive of the Professional Services Council, a trade group that represents federal contractors.

NASA has gone to great lengths to ensure the contracts were awarded properly.

“The agency is confident in the integrity of the HLS procurement,” NASA said in a statement to The Post. “Mr. Loverro was not the selection official, and his resignation has no impact on the performance of these HLS contracts.”

NASA Administrator Jim Bridenstine has declined to discuss Loverro’s departure from the agency, saying it was a “personnel issue.” He recently appointed Kathy Lueders, a NASA veteran, as Loverro’s replacement, praising her as someone with “the right set of skills and the right leadership qualities to take our agency deeper into the solar system.”