To Iranians, Shiraz is known as the city of poetry and roses.

To Norwegian Air Shuttle ASA, it has become the focus of a two-month battle to retrieve a Boeing Co. jet that’s been trapped in the net of U.S. sanctions.

The 737 Max aircraft made an emergency landing in Shiraz on Dec. 14 after developing engine problems while en route from Dubai to Oslo. Passengers were flown out the next day, but the stricken plane has been grounded in the ancient city at the foot of Iran’s Zagros mountains ever since.

Norwegian Air initially imagined it would be a straightforward matter to fly in the needed parts, said Reza Jafarzadeh, head of public relations at Iran’s Civil Aviation Organization. “Then it realized that there was a bigger problem.”

On Wednesday, Norwegian said it was finally in the process of sending a replacement engine after weeks of frustration.

The Scandinavian discount carrier’s experience provides an insight into the morass of legal wrangling and bureaucracy that can ensue when a company becomes entangled, however inadvertently, in international power politics.

The sanctions on Iran, reinstated by President Donald Trump last year, ban the sale of a range of products with at least 10 percent U.S. content, aircraft parts included. The restrictions left Norwegian scrambling to secure clearance to obtain spares, while all the time losing revenue from the grounded jet and likely paying to keep it stationed at the Iranian airport.

Government Shutdown

Adding to its woes, the airline, which has been struggling with a cash crunch after a period of over-rapid growth, found itself seeking help from the U.S. Treasury’s Office of Foreign Asset Control in the middle of the federal government shutdown.

The carrier may also have needed to persuade relevant third parties such as banks to become involved, said Farhad Alavi, managing partner of Akrivis Law Group in Washington, which advises companies on the sanctions. He described the situation as “a perfect storm.”

Norwegian’s headache finally eased when Boeing received a license from OFAC “to assist with the repair of the Norwegian 737,” Gordon Johndroe, a spokesman for the Chicago-based company, said by phone.

General Electric Co., the U.S. partner in engine maker CFM International, will also have needed to obtain permission to ship the replacement power plant.

“It is too early to say exactly when the aircraft will be airborne,” Norwegian said. “But our aim is to have it back home within the next week.”