The Aug. 4 explosion in Beirut left hundreds dead or missing, and many thousands injured or homeless. The blast destroyed important food reserves in a country that was already on the brink of bankruptcy.

But there’s another story here. Behind this explosion lies a complex system of loopholes in global maritime regulations — and a system that allows owners to abandon ships and cargoes with little legal ramification.

The explosion traces back to the MV Rhosus, an abandoned ship that had been moored at Lebanon’s Beirut Port since late 2013. The ship’s cargo — 2,750 tons of ammonium nitrate — was stored in a hangar at the port for almost six years. While it isn’t clear exactly what ignited the blast, here’s what we do know about how the cargo ended up in Lebanon.

The Rhosus was sailing under a “flag of convenience” (FOC) when it docked in Beirut in November 2013. Lebanese authorities detained the vessel shortly after it arrived in Beirut for failing to pay port dues and not meeting international regulations.

Ships are supposed to be registered and regulated

Under international maritime law every ship must be registered in a particular country, to sail under that flag. Registering a ship is similar to obtaining legal residence. It obliges the ship’s owner to pay taxes to the flag country and abide by its laws. Since about the mid-20th century, however, commercial ships have made increasing use of registration loopholes. Certain countries have created an “open register,” which allows commercial ships to register under a flag state different from their country of origin.

This laissez-faire business practice provides what is known as flags of convenience. FOCs allow shipowners and companies to avoid rising wages and tighter regulations in their home countries. It may also be a way to remain anonymous, or enjoy lower tax rates.

The countries that offer FOCs make a profit from the registration fees. Panama has over 8,000 registered vessels — more than the United States. Liberia, another popular FOC, makes about 6 percent of its yearly national budget from the practice. This has tempted other countries, such as Moldova — which is almost entirely landlocked, and has absolutely no history or tradition of ports or maritime transportation” — to get into the game.

The Rhosus, owned by a Russian businessman, was sailing under Moldova’s flag at the time of its abandonment (a practice FOCs make easier for legal and financial reasons). The ammonium nitrate was bound for Mozambique but ended up in Beirut Port’s Hangar 12, where it remained until last Tuesday. Upon arrival, Beirut’s Port State Control inspected the ship and determined, under the International Maritime Organization (IMO) regime, it was in violation of international standards. But fearing rising costs, the owner eventually abandoned the ship due to alleged personal financial troubles.

International law is murky

International maritime law governs maritime transport around the world, with many rights and responsibilities covered by the United Nations Convention on the Law of the Sea (UNCLOS). But UNCLOS does not regulate open registers or FOCs, or make them illegal. With no provisions explicitly prohibiting these regimes, shipowners are not deterred from risky conduct. Here are some of the challenges:

First, there is no clarity in crucial definitions. For example, according to UNCLOS, there only needs to be a “genuine link” between a nation and a ship registering in that country to grant nationality. However, “genuine link” is left undefined. This allows a kind of circular reasoning, under which the “genuine link” that allows a ship to be registered is often equivalent to the act of registration itself. This can lead to countries without the necessary facilities to do so verifying the safety and security of ships that other countries would probably view as unseaworthy.

Furthermore, the flag links the vessel to the country that will have (exclusive) legal jurisdiction over it. That means only Moldova was responsible for controlling the Rhosus’s activities and was obliged to apply its domestic law as well as international law. Crucially, however, international law provides no immediate consequences where a flag state neglects to exercise effective jurisdiction.

In addition, the flag states in question usually lack the tools to enforce international laws — but also may have little reason to do so. Registering with an FOC can be appealing to ship owners, precisely because these countries exist in a legal gray area. A country may have the international legal authority to register ships, but not have effective institutions that would allow them to legally regulate them.

This means it is far from unusual for ships like the Rhosus to be abandoned, and their crews left stranded over money or safety issues. There are some international protections for abandoned seafarers, notably in the Maritime Labor Convention of 2006, but they are relatively minimal and often inadequate.

FOCs are associated with regulatory failure

These loopholes also help explain why FOCs may be implicated in environmental emergencies — as well as risky business.

The 2010 Deepwater Horizon oil spill in the Gulf of Mexico, the largest marine oil spill in history, occurred in a rig operated under a Marshallese FOC. A congressional hearing raised questions over whether the foreign flag was used as a way to bypass U.S. safety regulations.

FOCs were also involved in oil pollution off the French coast in 1999, an Australian-bound freighter smuggling $50 million worth of heroin, and North Korean Scud missiles transported to Yemen.

Lena Obermaier is a senior teaching fellow for the Middle East at the School of Oriental and African Studies (SOAS) in London.

Lauranne Duffaut is an international lawyer focusing on environmental justice and disaster risk management.