The suspects, all Saudi nationals, were named as Hilal Jaber Awad al-Assiri, Zuher Hilal Mohammed al-Tbaiti and Abdullah Musafer Ali al-Ghamdi.
In the first Moroccan on-the-record official comment on the arrests, Prime Minister Abderahmane Youssoufi praised the country's security services.
The alleged al-Qaeda members are believed to have been arrested in May.
An unconfirmed report says the wives of two of the suspects were also arrested, on suspicion of acting as couriers for the group, and that all five detainees are due in court on in Casablanca next week.
The men, aged between 25 and 35, are reported to have links to al-Qaeda, the organisation suspected of carrying out the 11 September attacks in the United States.
Officials, speaking on condition of anonymity, said the suspects planned to sail inflatable dinghies loaded with explosives alongside ships patrolling the straits.
In October 2000 two suicide bombers, suspected by the US of being members of al-Qaeda, carried out a similar attack against the USS Cole in Yemen killing 17 sailors.
Working in Morocco
The three Saudis ran their own import and export, tourism and employment businesses in Morocco, according to newspaper reports.
The suspects were planning to sail from Ceuta and Melilla, the Spanish enclaves on Moroccan territory, the officials said.
The British Foreign Office issued a statement welcoming "the arrests if they involve individuals who may have been planning terrorist attacks against UK assets".
The UK Ministry of Defence said it had no knowledge of specific threats to Royal Navy ships.
A French judicial official on Monday confirmed the existence of "an anti-terrorist police operation in liaison with Western interests in the Strait of Gibraltar".
Joint operation
The arrests in Morocco were made with the help of intelligence services of "several friendly countries," one official told the Associated Press news agency.
The men placed under arrest are not wanted in any other country, sources said.
The three are reportedly being held in Casablanca prior to their interrogation.
Analysts suggest that the Moroccan authorities had kept silent about the May arrests because they did not want their country associated with Islamic militancy.
The authorities were forced to act when a French news magazine, L'Express, reported the story on Monday.