MADRID, Spain (CNN) -- All 36 crew members of a Spanish fishing boat hijacked by Somali pirates more than a month ago have been freed along with their vessel, the Spanish prime minister said Tuesday.
"Our sailors of the Alakrana are free and will come home," Prime Minister Jose Luis Rodriguez Zapatero announced in a news conference. "These tough weeks have ended in a very positive way."
Zapatero did not say how the ship was freed. Spanish media -- including CNN sister station CNN+, which cited a source it said was close to the negotiations -- reported that a ransom had been paid.
The prime minister congratulated the armed forces, diplomats, intelligence services, and the government for their role in freeing the ship. He also thanked the political parties that entered into an agreement ahead of the Alakrana's release, but he did not give details.
"Alakrana now sails freely because many people have contributed, especially the wives and the families of the crew, who have had a very hard time, but have behaved very well," Zapatero said.
"I want to say thank you to them for complying faithfully with what I asked of them in our meeting. This has been decisive for us to be able to feel safe in this situation today."
The fishing boat is now "sailing freely toward safe waters," Zapatero said, adding "all crew members are safe and sound."
Pirates seized the Spanish fishing boat off Somalia 47 days ago. The crew included 16 members from Spain and 20 from Africa and Asia.
A day after the hijacking, Spanish military monitoring the situation captured two pirate suspects as they left the fishing boat and later brought them to Madrid. The two were indicted Monday on 36 counts of kidnapping and armed robbery.
They could face sentences of more than 200 years in prison each because of the multiple kidnapping counts.
But the ship's owner, Echebastar Fleet, and relatives of the crew members had pleaded with the court and the Spanish government to return the two suspects to Somalia, as pirate representatives had demanded in conversations with Spanish media.
It is thought to be the first time suspected Somali pirates had appeared before a Spanish judge and been indicted.
Spanish media have reported that various other European countries have sent Somali pirate suspects -- which their respective armed forces captured -- to Kenya to face judicial proceedings, but did not bring them to Europe.
Pirates have captured more than 50 ships this year off Somalia and are currently holding 12, including the Alakrana, Spanish Defense Minister Carme Chacon said recently.
About a dozen other Spanish fishing boats had taken refuge in the Seychelles Islands but over the weekend, dozens of private Spanish security personnel arrived there and boarded the ships, with their weapons, to provide security, as other nations are doing for their fishing fleets in the troubled waters.
Spain is part of a European Union task force against piracy in the Indian Ocean off Somalia. The Spanish parliament last January agreed to increase Spain's presence with up to 395 troops and assets, including a frigate and aircraft.
Chacon told Parliament before the vote that the fight against piracy "is of vital importance for the defense of the geostrategic and economic interests of Spain, and will provide security to our fishing fleet."
CNN's Al Goodman in Madrid, Spain, and Per Nyberg in London, England, contributed to this report.