European Union ministers have reached a deal on 2007 fishing quotas, aimed at helping depleted stocks recover.
Talks went on late because of the large number of fisheries to discuss
They agreed a series of concessions including a 14% cut in the North Sea cod catch - down from an original proposal by Brussels of a 25% cut.
Cod will be further protected by a cut in the days boats spend at sea. A rise in some other catches is being allowed.
Environmental groups criticised the EU for ignoring scientists' warnings of a need for a total ban on cod fishing.
EU Fisheries Commissioner Joe Borg said the commission was trying to balance the need to rebuild depleted fish stocks with the needs of those whose livelihoods depended on fishing.
"The result was a proposal that has been severely criticised by all sides for being too drastic for some and too weak for others," he said.
"Yet despite the difficulties I believe that the agreement reached tonight reinforces our gradual but sustained approach to delivering sustainable fisheries."
He confirmed that cod catches would be cut by 20% off the west coast of Scotland and in the Celtic Sea (to the south of Ireland), and by 15% in other areas, except the North Sea where it would be cut by 14%.
'Signs of recovery'
The number of days cod fishermen spend at sea was reduced by between 7% and 10%. The current maximum is about 15 days a month, depending on the type of fishing gear used and the exact fishing ground.
The commission originally recommended a 25% cut in days at sea. A revised proposal of a 12% cut was also rejected.
The UK argued that the deal should take into account the 65% reduction in effort put into catching cod British fishermen had made over the past four years.
UK Fisheries Minister Ben Bradshaw said the UK accepted there had to be further reductions in the cod catch, and that the stock was still in very poor shape, but he added that more cod had been born in 2005 than in any year since 1996.
"The agreement builds on the considerable cuts in cod catches already made in recent years," he said.
"The impact on our fishing fleet will be more than compensated for by big increases in catches allowed for prawns, haddock, mackerel and monkfish - each of which is already more valuable than cod to our fishermen."
French agriculture minister Dominique Bussereau said it was a "fair and acceptable agreement" built on compromise.
Fishermen's associations in Scotland and Northern Ireland warned that the cut in the number of fishing days would hit the industry hard.
But environmental campaign groups WWF and Greenpeace both criticised the deal as threatening the extinction of cod by failing to allow stocks to recover.
"Cod in the North Sea will be wiped out if fishing is allowed to continue," said Greenpeace oceans campaigner Willie Mackenzie.
"Fisheries ministers across Europe have ignored the warnings of their own scientists of a need for a 'zero catch' allowance for North Sea cod."
In southern EU countries, the ministers agreed an increase in the catch of northern hake by 20% and Bay of Biscay sole by 12%.
However, plaice quotas were reduced by 12.5%.
The issue of anchovy fishing in the Bay of Biscay held up the deal. The commission had wanted a complete ban in the first half of 2007 but was forced to yield some ground.
In theory the ban will be in force but with "very limited and very carefully monitored" fishing permitted for a small number of vessels - 20 from Spain and eight from France.
Anchovy fishing was banned in the Bay of Biscay from July 2005 to the end of February 2006, and again from July 2006 to the end of this year.
The ministers have agreed to a cut of roughly 10% in the catch of bluefin tuna in the Mediterranean - in line with international agreements - but negotiations on the EU's share of this catch will be left until the end of January.
Outside the talks on Tuesday, demonstrators from the WWF handed out restaurant menus for the year 2050, predicting that the only fish meals available might be jellyfish and "tofu cod".
However, the commission says that a zero quota for cod would affect boats fishing for other species such as haddock, whiting and prawns, where some cod is caught unintentionally.
It says that it is unrealistic to completely close all these fisheries.