Ships sailing under a British flag will be able to carry armed guards to protect them from pirates, the prime minister has announced.
David Cameron says he wants to combat the risks to shipping off the coast of Somalia, where 49 of the world's 53 hijackings last year took place.
Under the plans, the home secretary would be given the power to license armed guards for ships.
No ship carrying armed security has yet been hijacked, the government claims.
Up to 200 vessels flying the red ensign - the British merchant navy flag - regularly sail close to Somalia. Officials estimate that about 100 of those would immediately apply for permission to have armed guards.
Under the 1982 United Nations Convention on the Law of the Sea every ship is subject to the jurisdiction of the country whose flag it carries.
It is thought many British-registered ships already carry armed guards because they feel they have no alternative.
However, licensing ships to carry armed guards could still fall foul of laws in other countries. Egypt recently announced that armed guards would not be permitted on ships sailing through the Suez canal.
Shoot to kill?
Mr Cameron said he wanted to legalise armed guards after talks in Australia with Commonwealth leaders from the region over the escalating problem faced in waters off their shores.
But armed guards would only be permitted while passing through dangerous waters, such as the Red Sea and the Gulf of Aden.
Previous government policy had strongly discouraged the use of private armed guards on board UK vessels.
But ministers began to consider amending the position to combat piracy in "exceptional circumstances", Foreign Office Minister Henry Bellingham said in a submission to the Commons' Foreign Affairs Committee earlier this year.
The Home Office looked at how to apply UK firearms legislation on board UK ships, and whether it was feasible to authorise and monitor the possession of "prohibited" firearms at sea, he said.
Mr Cameron was asked if he was comfortable with giving private security operatives the right to "shoot to kill" if necessary, and told BBC One's Andrew Marr Show: "We have to make choices.
"Frankly, the extent of the hijack and ransom of ships round the Horn of Africa is a complete stain on our world.
"The fact that a bunch of pirates in Somalia are managing to hold to ransom the rest of the world and our trading system is a complete insult and the rest of the world needs to come together with much more vigour."
The International Chamber of Shipping (ICS), which represents over 80% of the world's merchant fleet, welcomed the move as likely to have a deterrent effect - but said it was only a "short-term measure".
Secretary general Peter Hinchliffe said the ICS was concerned about how pirates would respond to the move.
"To date, no ships with armed guards on board have been captured. But pirates will respond with increased firepower to overwhelm the armed guards, and when that happens the impact on the crew will be pretty dreadful," he told Reuters.
Peter Cook, director of the Security Association for the Maritime Industry (Sami), welcomed the policy change, but Commodore Angus Menzies, from the Honourable Company of Master Mariners, said it would "shift the problem elsewhere".
Mr Cook said many armed guards were former Royal Navy and Royal Marines personnel, and he added: "With the current redundancies it has provided them with an ideal place to go."
Transport Secretary Justine Greening said it was "sensible" for ships to be able to take "appropriate measures to protect their crew and cargo".
Shadow Foreign Office Minister, John Spellar, welcomed the move but said more details were needed from the government about how it would be implemented.
High velocity rifles
Sami director Mr Cook said most armed guards would be using high velocity rifles, which were used to "deter pirates" from attempting to board a ship.
He confirmed that no vessel with armed guards had been taken over by pirates, and said in several cases guards had fired shots at pirates.
The general secretary of the International Transport Workers' Federation, David Cockroft, told the BBC: "This is a reassuring move for the seafarers, but the worry is that in the past we've seen the pirates respond to each new defensive measure by choosing heavier weapons and more savagery.
"There is no substitute for all the big shipping flags taking the fight to the pirates themselves, with action against their bases, arrests and jailings."
"So far some of the biggest registers, all flags of convenience, are leaving it all to Nato, EU Navfor, combined forces and a few independent deployments."
Maritime risk consultants Haymarket said the introduction of armed guards would save the British shipping and insurance industries millions of pounds.
John Bisseru, a maritime risk specialist at the firm, said: "Prevention is the way forward, and qualified and trained armed guards will be significant step."
France and Spain provide so-called military vessel protection detachments, while Italy is planning a similar measure.
In July, the Foreign Office Minister Mr Bellingham said limited military resources meant it was not possible to free up Royal Marines for a ship protection role.
Other counter-piracy measures being taken include offering support from Treasury officials to Kenya to help its officials track down pirates' assets.
Mr Cameron also said help could be given to countries such as the Seychelles and Mauritius who were acting to bring pirates to court and imprison them.