WASHINGTON — The Secretary of Commerce threatened to fire top employees at the federal scientific agency responsible for weather forecasts last Friday after the agency’s Birmingham office contradicted President Trump’s claim that Hurricane Dorian might hit Alabama, according to three people familiar with the discussion.

That threat led to an unusual, unsigned statement later that Friday by the agency, the National Oceanic and Atmospheric Administration, disavowing the National Weather Service’s position that Alabama was not at risk. The reversal caused widespread anger within the agency and drew accusations from the scientific community that the National Weather Service, which is part of NOAA, had been bent to political purposes.

NOAA’s statement on Friday is now being examined by the Commerce Department’s Office of Inspector General, according to documents reviewed by The New York Times, and employees have been asked to preserve their files. NOAA is a division of the Commerce Department.

The National Weather Service “must maintain standards of scientific integrity,” the inspector general, Peggy E. Gustafson, wrote in a message to NOAA staff members in which she requested documents related to Friday’s statement. The circumstances, she wrote, “call into question the NWS’s processes, scientific independence, and ability to communicate accurate and timely weather warnings and data to the nation in times of national emergency.”

The Commerce Department disputed the account on behalf of the Secretary of Commerce, Wilbur L. Ross Jr. “Secretary Ross did not threaten to fire any NOAA staff over forecasting and public statements about Hurricane Dorian,” the department said in a statement issued by a spokesman.

The spokesman declined to comment on whether Mr. Ross had spoken with the NOAA administrator or ordered the agency to rebut the statement contradicting the president’s assertion about a threat to Alabama.

The Commerce Department’s Office of the Inspector General did not respond to requests for comment late Monday.

The accusations against Mr. Ross are the latest developments in a political imbroglio that began more than a week ago, when Dorian was bearing down on the Bahamas and Mr. Trump wrote on Twitter that Alabama would be hit “harder than anticipated.” A few minutes later, the National Weather Service in Birmingham, Ala., posted on Twitter that “Alabama will NOT see any impacts from Dorian. We repeat, no impacts from Hurricane Dorian will be felt across Alabama.”

Mr. Trump persisted in saying that Alabama was at risk and a few days later, on Sept. 4, he displayed a NOAA map that appeared to have been altered with a black Sharpie to include Alabama in the area potentially affected by Dorian. (Alabama was not struck by the hurricane.)

Mr. Ross, the commerce secretary, intervened two days later, early last Friday, according to the three people familiar with his actions. Mr. Ross phoned Neil Jacobs, the acting administrator of NOAA, from Greece where the secretary was traveling for meetings and instructed Dr. Jacobs to fix the agency’s perceived contradiction of the president.

Dr. Jacobs objected to the demand and was told that the political staff at NOAA would be fired if the situation was not fixed, according to the three individuals, who requested anonymity because they were not authorized to discuss the episode.

The political staff at an agency typically includes a handful of top officials, such as Dr. Jacobs, and their aides. They are appointed to their jobs by the administration currently in power, as opposed to career government employees, who remain in their jobs as administrations come and go.

NOAA ultimately issued an unsigned statement last Friday calling the Birmingham office’s statement “inconsistent with probabilities from the best forecast products available at the time.”

A senior administration official who asked not to be identified when discussing internal deliberations said that the Birmingham office had been wrong and that NOAA had simply done the responsible thing and corrected the record.

That official suggested the Twitter post by the Birmingham forecasters had been motivated by a desire to embarrass the president more than concern for the safety of people in Alabama. The official provided no evidence to support that conclusion.

Craig N. McLean, NOAA’s acting chief scientist, sent an email to staff members Monday notifying the agency that he was looking into “potential violations” in the agency’s decision to ultimately back Mr. Trump’s statements rather than those of its own scientists. He called the agency’s action “a danger to public health and safety.”

Also on Monday, the National Weather Service director, Louis W. Uccellini, prompted a standing ovation at a weather industry conference in Huntsville, Ala., when he praised the work of the Birmingham office, asked them to stand and said staff members had acted “with one thing in mind, public safety” when they contradicted Mr. Trump’s claim that Alabama was at risk.

The NOAA episode is the latest example of administration officials moving levers of government to accommodate Mr. Trump’s statements. And few cabinet officials have been as loyal to Mr. Trump as Mr. Ross.

A billionaire investor, former steel magnate and friend and ally of Mr. Trump from the business world before joining the cabinet, Mr. Ross has in the past vigorously sought to advance divisive positions at the Commerce Department in support of policies advocated by Mr. Trump. He fought to add a citizenship question to the 2020 census, only to lose in a stinging Supreme Court rebuke. He has also stood by the president on controversial decisions such as imposing tariffs on aluminum imports.

Mr. Trump himself has shown less deference than his predecessors to the traditional boundaries between the political and Civil Service sides of the government. Most notably, he has repeatedly called on the Justice Department to investigate his enemies.

In the NOAA dispute, Mr. Trump has also enlisted his Homeland Security adviser to issue a lengthy statement defending him.

Richard Hirn, general counsel for the National Weather Service Employees Organization, said what made the NOAA episode extraordinary, though, was that it was not part of an overarching policy dispute on a contentious topic like climate change. “This is just to cover up an embarrassing mistake the president made,” he said.

Mr. Hirn, who said he has worked with the agency through six administrations, added that, “Never before has anybody tried to politicize the weather in all the administrations I’ve worked with.”

Noah Bookbinder, executive director of Citizens for Responsibility and Ethics in Washington, a nonpartisan watchdog group, said that political appointees served at the pleasure of the president and the cabinet secretary and could be fired at will. But, he said, threatening to fire staff members under these circumstances “goes against the norms and traditions that have been important to the government and are important to a functioning democracy.”

Peter Baker is the chief White House correspondent and has covered the last four presidents for The Times and The Washington Post. He also is the author of five books, most recently “Impeachment: An American History.” @peterbakernyt•Facebook

Christopher Flavelle covers climate adaptation, focusing on how people, governments and businesses respond to the effects of global warming. @cflav

Lisa Friedman reports on climate and environmental policy in Washington. A former editor at Climatewire, she has covered nine international climate talks. @LFFriedman

A version of this article appears in print on , Section A, Page 1 of the New York edition with the headline: U.S. Secretary Said to Coerce NOAA Leaders. Order Reprints | Today’s Paper | Subscribe