A scheme backed by the government will include alternative job training, replanting projects and microloans.
Mangroves are considered to be one of the world’s most at-risk habitats, with more than half being lost or destroyed in the past century.
Conservationists hope other mangrove-rich nations will follow suit and adopt a similar protection model.
Commenting on the agreement, Sri Lanka President Maithreepala Sirisena said: “It is the responsibility and the necessity of all government institutions, private institutions, non-government organisations, researchers, intelligentsia and civil community to be united to protect the mangrove ecosystem.”
The Sri Lankan government is a joint partner overseeing the measures, alongside global NGO Seacology, and Sri Lanka-based Sudeesa, which was formerly known as the Small Fishers Federation of Lanka.
Seacology executive director Duane Silverstein said the pioneering framework had “extreme importance as a model” that could be used throughout the world.
“No nation in history has ever protected all of its mangrove forests and Sri Lanka is going to be the first one to do so,” he told BBC News.
“This is through a combination of laws, sustainable alternative incomes and mangrove nurseries.
After the 2004 (Indian Ocean) tsunami, it became evident - particularly in Sri Lanka which was severely impacted - that those villages that had intact mangroves suffered significantly less damage than those that did not.
Duane Silverstein, Seacology executive director
It is also very significant considering the importance of mangroves as a means of sequestering carbon.”
“It is not only that mangroves sequester an order of magnitude more carbon than other types of forest, but it is sequestered for so much longer.
“In the case of mangroves, it is forecast that this lasts millennia,” he observed.
Mangroves are evergreen trees that are found in more than 120 tropical and sub-tropical nations.
They are able to grow in seawater, and their strong, stilt-like root systems allow them to thrive in swamps, deltas or coastal areas.
The trees sequester the carbon in the top few metres of soil, which is primarily an anaerobic environment - without oxygen.
As a result, the organisms that usually lead to the decomposition of organic material are not present, meaning the carbon remains locked in the environment for longer.
Because of their surrounding habitat and the lack of readily available fuel, mangrove forests are also not susceptible to forest fires.
But mangroves also offer coastal communities a more direct and immediate form of protection, explained Mr Silverstein.
“After the 2004 (Indian Ocean) tsunami, it became evident - particularly in Sri Lanka which was severely impacted - that those villages that had intact mangroves suffered significantly less damage than those that did not.
A report by the International Union for Conservation of Nature (IUCN) published 12 months after the devastating tsunami compared two coastal villages in Sri Lanka that were hit by the wall of water.
It showed that two people died in the settlement with dense mangrove and scrub forest, while up to 6,000 people died in the village without similar vegetation.
“Another advantage of a healthy mangrove ecosystem is that the stilted root systems serve as nurseries for many of the fish species that go on to populate coral reefs.
Healthy fish populations, sustained by healthy mangrove forests, have also provided livelihoods and nutrition for millions of small-scale fishermen and their families for generations, allowing coastal communities to sustain themselves.
Anuradha Wickramasinghe, chairman of Sudeesa, said: “People live in these areas because they depend on the mangroves because a lot of the fish they catch come from mangroves.
But he added: “Shrimp farmers have been either legally or illegally cutting down mangroves.
Farmed shrimps, or prawns, account for more than half of the global demand for the crustaceans.
A UN report published in November 2012 warned that the growing demand for prawns meant that valuable mangrove forests were still being felled or were under threat of being felled.
Mr Wickramasinghe told BBC News: “Shrimp farming results in a significant fall in fish catch yields, so fishermen are losing income so it costs them their livelihoods.
“So they know about the importance of mangroves and they are keen to protect them.
Mr Silverstein hoped the Sri Lanka protection model would be adopted by other nations.
“We absolutely believe that Sri Lanka’s mangrove model will serve as a model for other nations to follow.”
The scheme, which will cost US $3.4m over five years, aims to protect all 8,800 hectares (21,800 acres) of existing mangrove forests by providing alternative job training, funding microloans to people in exchange for protecting local mangroves forests.
It also involves a replanting project, which aims to replace 3,900 hectares of mangroves that had been felled.