The Navy is allowed to board and detain a ship under the United Nations Convention on the Law of the Sea, Article 108, which tasks all states to fight narcotics trafficking. This article gives the primary task to do so to the ship's nation. However, as another nation, to board a ship under the Spanish flag, the convention demands only cooperation with Spanish law enforcement. In Europe, a request to assist in naval law enforcement is routinely given, especially in drug enforcement cases. In fact, Spain and Portugal both are founding members of
Maritime Analysis and Operations Centre (Narcotics), which is a task force dedicated to hunting drug trafficking vessels. It is very likely that the operation was coordinated via MAOC(N), using Portuguese assets to execute the operation.
Illicit traffic in narcotic drugs or psychotropic substances
All States shall cooperate in the suppression of illicit traffic in narcotic drugs and psychotropic substances engaged in by ships on the high seas contrary to international conventions.
Any State which has reasonable grounds for believing that a ship flying its flag is engaged in illicit traffic in narcotic drugs or psychotropic substances may request the cooperation of other States to suppress such traffic.
As far as news reported, the ship hoisted the Spanish flag, such as Funchal News.
In either case, after they boarded the ship, the police detained the ship in Portugal for a crime that was committed in Portugal - the crew had allegedly been selling their cargo there on a previous trip. The case about the ship was heard in Funchal in the Madeira region, by a Madeira court. As a result of that case, the ship was duly seized as an implement of drug trafficking and became government property of the court's region - which is the Madeira region.
A 13 de Abril de 2009, o "Blaus VII" foi declarado «perdido a favor do Estado» por decisão transitada em julgado do Tribunal de Vara Mista do Funchal, passando o veleiro a constituir parte do património da Região Autónoma da Madeira.source
On the 13th of April 2009, the "Blaus VII" was declared "lost to the State" by a final and unappealable decision of the Mixed Court of Funchal, with the sailboat becoming part of the heritage of the Autonomous Region of Madeira.
The Laws that allowed them to take ownership were also recited in the Funchal News article above: Lei nº 130/99, de 21 de Agosto, art. 145º, al. Decreto Legislativo Regional nº 25/2002/M, de 23 de Dezembro and decreto-lei nº 31/85, de 23 de Janeiro were part of the seizing process.
The Madeira government then had the choice to auction the ship off or use it for government operations or otherwise dispose of it. As a result, the Region of Madeira signed a cooperation with the Navy to handle the ship's maintenance. As their property, they then transferred the ship to the Navy in July 2014 in exchange for that fort, constituting a sale to dispose of their legal property to acquire the land of a historic landmark