After weeks of fiery negotiations, the smoke finally cleared Thursday in the case of the Kensington junkyard that was the site of a spectacular four-alarm blaze in July.

Operators of the junkyard received a dramatically reduced fine stemming from fire code infractions that the city claimed stretched back years, and the city won tougher regulations as part of a settlement both parties agreed upon Thursday.

The settlement requires David Feinberg to pay the city $125,000, a 95 percent decrease from the original fine of $2.7 million. But according to the agreement, if Feinberg can pay $100,000 of the fine in the next 48 months, the remaining $25,000 balance will be forgiven.

The attorney for Feinberg, owner of Philadelphia Metal & Resource Recovery, called it a "hard-fought negotiation."

"But in the end, it allows my client to be a good neighbor and continue operations, and the city to have a little bit more enforcement capabilities," said the lawyer, Darlene Threatt.

In a news release, Kristin Bray, chief deputy solicitor of the Law Department's code enforcement unit, said the city is pleased with an agreement that "provides real solutions to the neighborhood by ensuring that the junkyard can no longer be operated in a manner that hurts the community."

"It holds the owner accountable because he faces substantial financial penalties and the shutdown of the business if he fails to follow through on his commitments," she added.

The four-alarm fire July 10 in the 2200 block of East Somerset Street, which blazed out of control for nearly three hours but caused no injuries, helped spark a review of the dozens of junkyards across Philadelphia.

Citing a raft of violations, Licenses & Inspections officials ordered Feinberg's site closed, but he was able to reopen it weeks later. Although the junkyard has cleared 100 percent of the nuisance violations cited by L&I, the city was seeking compensation for code infractions dating back to 2014.

» READ MORE: Kensington junkyard battle rages on in courtroom

Under the agreement, the junkyard operators would face immediate closure and risk serious fines if pile heights, access lanes, and storage drums are found violating safety regulations.

Feinberg also agreed to maintain a clean and orderly property and to be mindful of any of his vehicles parking or idling near public spaces.

If Feinberg fails to meet any of those stipulations, the city reserves the right to charge him with the original fine.

"We ask for high fines not to make money for the city, but to deter unlawful and dangerous practices by those business owners who only understand one thing – a hit to the wallet," L&I Commissioner David Perri said in a news release. "If you're one of these owners, L&I and the Law Department are putting you on notice."