Marathon Petroleum Corp. said it was working to fix a malfunctioning flare at its Detroit refinery that created a pungent odor that permeated the air in metro Detroit on Sunday morning.

Jamal T. Kheiry, communications manager for Marathon, shared a statement saying the company was working "as safely and as quickly as possible" to fix the problem in the malfunctioning flare. He said in order to conduct repairs to the flare, workers were also removing the contents of various vessels connected to the flare.

"We don't have an estimate for when the repair work will be complete, but we have significantly reduced the amount of material going to the flare, and anticipate being able to de-pressure the vessels connected to the flare by the end of the day tomorrow," he later told the Free Press in an email.

Kheiry told the Free Press that Marathon anticipates workers will finish removing the contents of the vessels connected to the flare by the end of the day on Monday, and this will allow them to deactivate the flare.

At that point, repair work will begin, he said.

According to the statement, Marathon believes the odor is largely from mercaptan, which is a substance added to natural gas to give it a detectable smell.

"Although there has been an odor from the release, our ongoing air monitoring has not detected dangerous levels of any substances," the statement said.

"We will continue to conduct air monitoring on a constant basis in nearby communities as a precaution, and are making our air-monitoring data available to regulatory and emergency response agencies."

The statement added that an investigation to determine what caused the release is ongoing, and once that is determined, Marathon plans to implement "necessary corrective actions so that this does not happen again."

The Marathon refinery is located in southwest Detroit and borders the city of Melvindale, Kheiry said.

Wind blowing from the west carried the odor north and northeast. Some people noticed it miles away in Warren in Macomb County.

Early Sunday, around 4 a.m., Michigan State Police and local 9-1-1 centers began receiving phone calls from metro Detroit residents reporting a strong odor permeating the air, MSP said.

In a series of tweets, MSP said it suspected that the smell was coming from Marathon Oil properties, and that its Emergency Management and Homeland Security Division has been in contact with Marathon, plus local authorities around the Detroit/Dearborn border.

"At this time Marathon still shows NO air quality issues on their meters," MSP said in a tweet. "Based on wind direction Marathon agrees their facility could be the source."

According to a 6:41 a.m. notification from Dearborn Police: the Marathon refinery was made aware of the odor in the air and reported that there is no health hazard.

"They are actively monitoring the air quality at this time. Dearborn Police and Fire have also monitored the air quality and have not detected anything harmful," the notification said.

Kheiry shared a statement from Marathon apologizing for the odor around 10 a.m.

"Marathon Petroleum has determined that the source of the odor is a flare at the refinery that is not functioning properly and needs to be repaired. In order to make repairs, we must de-activate the flare. Flares are safety devices that allow us to safely combust excess materials at the refinery, and we are working on de-activating the flare as safely and quickly as possible."

The statement added that Marathon Petroleum deployed air-monitoring resources in affected areas, and while there is an odor, they have not detected dangerous levels of any substances.

"We apologize to the community for the odor and the inconvenience. Our highest priority is the safety of the community where we operate and those who work at our refinery. We will continue to work as safely end quickly as possible to resolve this matter. We are conducting a thorough investigation to determine what caused this release, and we will implement the necessary corrective actions so that this does not happen again," Kheiry said in a statement.

More on freep.com:

Police: Patient steals ambulance, crashes in Macomb County

Detroit police chief wants to demote cop after Snapchat video

In an update shared on Facebook, the city of Detroit said residents can contact the Michigan Department of Environmental Quality at 800-292-4706 to report any strong odors.

"Although the Michigan Department of Environmental Quality is taking the lead on monitoring of the air quality levels, the City’s Building Safety Engineering and Environmental Department has inspectors involved and is remaining in close communication with both Marathon and MDEQ," the post said.

Associated Press contributed to this story.

Contact Aleanna Siacon at ASiacon@freepress.com. Follow her on Twitter: @AleannaSiacon