Life on the coast is full of rewards. Shore-dwellers can exploit the ecological resources of the land and the sea. They can harvest both timber and seaweed. They can grow grains and gather shellfish. They can travel over the ground or over the waves. (Not to mention, they get great views.)

But those benefits come with risks. The coast is a demanding, ever-changing environment that requires ongoing adaptations. We can see such efforts today in carefully managed artificial sand dunes and levees designed to protect against pounding waves and rising water. And a new discovery shows that even in prehistory, coast-huggers were building these defenses, too.

Off the shores of northern Israel, archaeologists found a 7,000-year-old wall that stretches more than 330 feet (100 meters) long. The researchers have interpreted the structure as a seawall for a Stone Age village, making it the oldest such coastal defense structure that's ever been identified. The find was described today in the journal PLOS ONE.

"Coastal sites of this preservation quality and date are very uncommon globally," says archaeologist Anders Fischer, of Sealand Archaeology in Denmark, who was not involved in the study. Between 2009 and 2013, Fischer was the head of an EU-funded group that evaluated all available data on early prehistoric archaeology under water in Europe, Turkey and Israel. To his knowledge, he says, "there are no Stone Age wall-like features of this size known anywhere below present sea level."

The wall was discovered just off northern Israel's Carmel coast, where there's a high concentration of submerged Neolithic villages (at least 15) in the shallows, up to 660 feet (200 meters) away from shore. These sites, which archaeologists have known about for decades, are often covered in a protective layer of sand, but storms and heavy seas can occasionally expose new features.

Winter storms in both 2012 and 2015 revealed a long straight structure, says lead author Ehud Galili, a marine archaeologist at the University of Haifa in Israel. In each instance, portions of wall were exposed for just a few days before being covered again in shifting seafloor sand. In those brief windows, archaeologists donning snorkels and scuba gear were able to document the feature, which was about 10 feet below the surface.

The long wall was made up of big boulders, some of which could be more than 3 feet (1 meter) wide and weigh more than a metric ton (1,000 kg). The barrier was located on the western edge of an underwater village known as Tel Hreiz. Artifacts and the remnants of homes in the town suggest it could have supported a few hundred people, who likely relied on fishing and agricultural activities like making olive oil.

When the town was built about 7,000 years ago, it was likely about 7 to 10 feet above sea level, according to the study. But the first occupants may not have known they were settling in a quickly changing landscape. When the last ice age ended, melting glaciers around the world caused sea level to rise. And during the Neolithic era, water in the Mediterranean crept up about 27 inches (70 cm) over 100 years, which is faster than global sea level is rising today. The average sea-level rise alone may not have inundated the town, but the rising water likely caused winter storm surges to damage the town with more frequency over fewer generations, the researchers say.

"If it happened every 20 or 30 years, it's O.K., but if it started to happen every 10, 5 and then 2 years, then people realized they had to take action," Galili says.

Because of this environmental reality, the researchers concluded that the long wall must have been a seawall after ruling out other possible interpretations. The wall was too close to the Neolithic shore to have been part of an agricultural terrace, for example, and if it was a fortified wall to defend against invaders, one would expect it to surround the side of the village facing inland, Galili says.

Fischer says he hopes the researchers will keep investigating the site, despite the difficulties of working so close to shore in the surf zone. "Since it is such an unusual and globally interesting interpretation, it is important to keep observing the feature, constantly trying to gain new information and testing alternative interpretations," he says.

Galili and his colleagues write that such a large wall to divert water wouldn't have been unheard of in the region during the Neolithic era. A 10,000-year-old wall found at Jericho, nearly 60 miles inland in today's West Bank, may have been built for flood protection. Other Neolithic barrage systems have been found in southeast Jordan's landlocked Jafr Basin. But the discovery of a flood defense wall on the coast is a first.

If Tel Hreiz did have a seawall as the researchers believe, did it work? The inhabitants of the town invested a lot of time and energy into making this structure. Moving each of those boulders would have required the strength of multiple people. But it looks like at some point, adapting wasn't worth the effort, Galili says. Radiocarbon dates from the ruins suggest Tel Hreiz was inhabited for only 100 to 250 years before people abandoned the site. If their investments weren't paying off, their only other option was to leave. Eventually, Tel Hreiz and other coastal settlements became totally inundated, and archaeologists around the world now have a wealth of underwater prehistoric sites to study near the coasts, though these places risk rapid erosion once they're exposed.

Galili sees parallels between the problem the people of Tel Hreiz faced, and the environmental problems we face today as a result of climate change. "If the prediction of future sea level rise is accurate, then future generations will deal with the same dilemma," he says. (By 2100, the sea level around the world is likely to rise by an average of at least one foot, or 0.3 meters, above 2000 levels.)

We may not even have to look to future generations to imagine that dilemma, as cities like Venice, Miami and Jakarta increasingly suffer severe floods that make our coastal adaptations seem as futile as the wall of Tel Hreiz.