ISMAILIA, Egypt — The enormous ship that captivated the world when it ran aground in the Suez Canal earlier this year finally set sail on Wednesday, marking the end of a compensation dispute that dragged on long after a complicated salvage effort freed the behemoth in March.

The 1,300-foot-long cargo ship was allowed to depart the Great Bitter Lake — the part of the canal where it’s been anchored for months — once its owners and insurers reached a settlement with the Suez Canal Authority (SCA) over the incident, which was finalized in a ceremony in Ismailia on Wednesday.

“Today we are celebrating the end of the crisis,” Khaled Abu Bakr, an Egyptian lawyer representing the SCA, said in a speech at the ceremony, adding that they will keep the terms of the final agreement confidential.

The authority initially asked for $916 million to cover costs, including the efforts to free the boat and lost revenue. It later reduced its demand to $550 million. Egyptian media has since reported that the compensation package would also include a powerful new tug boat.

“The Ever Given is always welcome to pass through the Suez Canal in the future,” Abu Bakr said.

Early on the morning of March 23, the ship — which started its journey in Malaysia — entered the Suez Canal, a crucial cut-through between the Indian Ocean and Mediterranean Sea.

Soon after, the ship started veering from side to side, before hitting the canal’s eastern bank, where it became lodged.

For the next six days, the ship — which was on its way to Rotterdam — sat wedged in the waterway, causing major delays in global shipping as hundreds of other ships lined up waiting for it to move.

Some vessels, hoping to avoid the backup, opted to take a much longer route around Africa’s Cape of Good Hope.

The saga of the big, stuck ship enthralled observers and inspired countless memes, as crews embarked on a dramatic mission to free it.

On March 29, the vessel was finally refloated, sparking an outpouring of national pride across Egypt.

Once the disruption was cleared and traffic returned to normal, the world largely moved on from the story of the ill-fated Ever Given. But the crew working aboard the ship — and the roughly 18,000 containers they are transporting — just found themselves stuck somewhere new.

Goods worth at least a billion dollars by some estimates, including some belonging to IKEA and the technology company Lenovo, have sat on the ship for months pending the resolution reached this week. Before the ship was refloated in March, there were discussions about offloading the containers to lighten the ship’s load — a logistical nightmare that was set aside when the vessel was dislodged.

In the more than three months since, the ship has sat in the lake amid an investigation and lengthy debate over how much the SCA should be paid for the incident and who should be considered liable.

There were high winds and poor visibility at the time the ship steered into the bank, but details of the investigation into the cause of the grounding have not been made public.

The Ever Given is owned by Shoei Kisen Kaisha, a Japanese company, but it flies a Panama flag. A Taiwanese company, Evergreen Marine, operates the ship, which is managed by a German outfit. Several of the crew, who are all Indian, were allowed to leave in recent months, but most remain on board.

For Egyptians impacted by the incident, the ship’s impending departure came as a relief.

Eslam Negm, 33, who worked on its salvage efforts, said the success in refloating the ship in March made him “feel like I was a part of something huge.”

But now, he’s thrilled to see the ship get back on its way.

“Enough, I just want it to leave,” he said with a laugh.

Over the past several months, Negm has made regular trips to the Ever Given, dropping off SCA colleagues, as well as some provisions — including fresh vegetables and drinking water — for the crew, he said.

From far below, he could make out some of those stuck on board. “I felt sorry for them, they were just sitting there,” he said.

The crisis in March “made it clear how important the Suez Canal is to the whole world,” Farid Roushdy, senior chief pilot in the SCA, said in an interview.

Pilots prepare for unexpected situations, he said, but “emotionally, of course we were devastated” when the Ever Given got stuck.

Now, he said, attention is also focused on how to avoid similar incidents in the future. In the months since the disruption, Egypt has begun work to widen and deepen part of the canal to simplify the passage of large ships.

On Tuesday evening, dozens of Egyptians relaxed in plastic chairs and splashed in the water on the shore in the town of Fayed.

In the distance, small sailboats danced around the enormous Ever Given — its thousands of containers stacked high.

For months, the enormous ship and the strangers stuck on board have piqued the imagination of those who can see it from land.

“At night I see the lights turn on, and I wonder where the electricity comes from and how they’re really coping with the situation,” said Abdelrahman Ghareeb, 21, an engineering student who sells popcorn and cotton candy on the beach.

When the sun sets, some visitors even stop by just to see the ship light up, said Ramadan Ahmed, 35, a lifeguard, who said he often watches the ship and feels sad for the crew left in limbo.

“They are stuck between the land, the shore and the sky,” he said. “I’ll feel really happy for the workers when they get to go home and see their children.”