When it set sail on its maiden voyage in 1912, no one could have predicted what the opulent RMS Titanic would look like now – a rusting hulk at the bottom of the Atlantic Ocean. But at least something remains of the ship, more than a century after its ill-fated transatlantic journey.

However, scientists believe that in a few decades there may be nothing left of the ship at all, thanks to a species of bacteria which is slowly eating away its iron hull.

Robert Ballard, an oceanographer at the University of Rhode Island in Narragansett, discovered the wreck of the Titanic in 1985. What was not widely known at the time was that the discovery only came about because of Ballard's involvement in a secret US Navy mission to locate the wrecks of two US nuclear submarines sunk during the Cold War. It just happened that the Titanic was found between the two wrecks.

At the time of that initial discovery the ship was remarkably preserved. It is 3.8km below the surface, and the lack of light and the intense pressures make the area inhospitable to most life, slowing corrosion. Fast-forward 30 years, though, and the hull is rusting away, thanks to metal-munching bacteria. Some researchers now give the shipwreck just another 14 years before it is gone forever.

So what do we know about the microbe that is responsible?

The story started in 1991 when scientists from Dalhousie University in Halifax, Nova Scotia, Canada collected samples of icicle-like formations of rust – "rusticles" – hanging from the ship. They took them back to the lab and saw that they were teeming with life.

But it was not until 2010 that a separate group of scientists, led by Henrietta Mann at Dalhousie University, decided to identify what type of life it was.

The hull is rusting away, thanks to metal-munching bacteria

They isolated just one species of bacteria, and it turned out to be brand new to science. Mann and her colleagues named it Halomonas titanicae after the ship.

The bacteria can survive in conditions that are completely inhospitable to most lifeforms on Earth: water that is pitch-black and at crushing pressures.

But it has inherited another, even more astonishing trick. Halomonas bacteria are often found living in another type of extreme environment: salt marshes. Here, the salinity of water can vary dramatically because of evaporation, and Halomonas bacteria have evolved to cope with the problem.

If the water that bathes cells is too salty, water will rush out of cells, causing them to shrink, collapse and die. However, too little salt can be just as deadly. For instance, red blood cells placed in pure water burst as water floods in.

Both of these events happen because water "wants" to move from an area of high water concentration to an area of low water concentration, a phenomenon known as osmosis.

But what does this mean?

Salts, sugars and other small molecules all dissolve in water, clogging it up and taking up space, meaning that there is less space for the water itself. When these areas of low water concentration come into contact with pure water, the water will rush in to equalise the balance, in much the same way that warm air rushes out of a house in winter when the door is opened. As cell membranes are permeable to water, this means that all lifeforms are extremely sensitive to external and internal salt levels.

They isolated just one species of bacteria, and it turned out to be brand new to science

To stop their cells from bursting or shrinking, many species produce compounds like sugars or amino acids that keep the concentration of "stuff" inside their cells stable relative to the outside, stopping water flooding in or gushing out.

However, not many organisms can do so to the extent that Halomonas bacteria can. Joe Zaccai at the Institut Laue–Langevin in Grenoble, France is part of an international team of scientists who have analysed just how the bacteria can survive in such extreme and variable conditions. They found that Halomonas uses a molecule called ectoine to protect itself from osmotic pressure.

"If a cell is to survive in a fluctuating salt environment, it must have a way to compensate by adjusting the concentration of its internal solution," says Zaccai. "Halomonas produces ectoine in order to counterbalance the outside osmotic pressure. As the outside salt concentration fluctuates so will the ectoine concentration response."

In other words, the saltier the water gets, the more ectoine the bacteria produce inside their cells to stop water rushing out. However, this adaptation can be highly dangerous for an organism. The more "stuff" that accumulates inside a cell, the more it can get in between the water molecules, disrupting water's unique properties.

The reason that water is so absolutely necessary for life is that the unique bonds between its atoms – known as hydrogen bonds – allow it to act as a solvent. Other chemicals can dissolve in it, and can react together.

The reactions of life need to take place in a solution, which is why all our cells are bathed in liquid water. What's more, RNA and DNA, the proteins and enzymes responsible for carrying out the daily work of the cell, and the membranes which give them structure, need to be surrounded by a layer of water in order to function.

Microbes colonise a shipwreck almost immediately after the ship comes to rest on the seafloor

This layer of water, known as a "hydration shell", is crucial to maintain the correct folding of proteins, and in turn their function. If this was disrupted, then the proteins could unravel and fall apart, which would kill the cell.

As the bacteria clearly are able to accumulate extremely high concentrations of ectoine inside their cells – the study found that Halomonas produces so much ectoine that it accounts for 20% of the microbe's mass – the molecule must somehow leave these important properties of water in place.

To investigate how, the scientists led by Zaccai bombarded the bacteria with a beam of neutrons. By looking at the scatter pattern produced by neutrons bouncing off the atoms in the microbe's cell membranes and proteins, the scientists were able to "look" at structures at the molecular and atomic level.

There are few places in the world that are equipped for such experiments. The researchers worked at the Institut Laue Langevin, one of a handful of neutron research centres in the world.

"By watching how neutrons were scattered by different samples, we succeeded in determining how ectoine acts on proteins and cell membranes and, most importantly, water," says Zaccai. "Rather than interfering, [ectoine] actually enhances the solvent properties of water that are essential to biology".

It turns out that, no matter how much ectoine there is dissolved inside the cell, the shell of water surrounding proteins and the cell membrane remains 100% water, allowing the cell's metabolism to continue as normal. That is because, when the ectoine forms hydrogen bonds with water, it forms large clusters that will not fit on the surfaces of proteins and membranes, so only pure water can remain.

The shipwreck becomes a kind of artificial reef, home to a plethora of life

Initial investigations of H. titanicae showed it can grow in a water with as little as 0.5% weight by volume and as much as 25%, although it does best with a salt concentration between 2% and 8%.

However, it is not clear how, or if, this salt tolerance has helped it colonise the shipwreck.

H. titanicae is not the only bacteria that loves to inhabit shipwrecks. Various types of microbes colonise a shipwreck almost immediately after the ship comes to rest on the seafloor. They quickly build gooey sticky films over every available surface, called "biofilms". These biofilms are like a haven to corals, sponges and molluscs, which in turn attract larger animals.

Very quickly the shipwreck becomes a kind of artificial reef, home to a plethora of life.

Ancient wooden shipwrecks are set upon by microbes that feed on wood, whilst more modern steel ships attract bacteria like H. titanicae, which love to eat iron. Whilst H. titanicae may eventually destroy the Titanic, many of these bacteria actually protect their ships from corrosion, which is one of the reasons why we still have shipwrecks dating back as far as the 14th Century BC.

Once it hits the floor it becomes available to microbes that rush to cover every surface

In 2014, a team of scientists from the US Bureau of Ocean Energy Management (BOEM) conducted perhaps the most in-depth study to date into microbial life on shipwrecks. They looked at eight shipwrecks in the northern Gulf of Mexico. The shipwrecks included wooden-hulled sailing ships dating to the 19th Century, one wooden-hulled sailing ship possibly from as early as the 17th Century, and three World War Two steel-hulled vessels, one of which was sunk by a German U-boat.

They found that the material the ship was built from was the crucial factor that determined the type of microbe that was attracted to the wreck. Wooden ships were teeming with bacteria that attack and feed on the cellulose, hemicellulose, or lignin found in wood. Steel ships, on the other hand, were occupied mostly by iron-loving bacteria.

Strangely, although the bacteria were essentially feeding on the ship, they actually served to protect them from corrosion.

"In essence, what happens is that any vessel that sinks, be it a wooden 19th-Century ship or a steel-hulled ship from World War Two, once it hits the floor it becomes available to microbes that rush to cover every surface," says marine archaeologist Melanie Damour at BOEM in New Orleans, Louisiana, one of the expedition's lead scientists.

The 2010 Deepwater Horizon disaster spewed millions of gallons of oil into the Gulf of Mexico

"At first the ship will begin to corrode as it is in contact with seawater, but as microbes begin to colonise the wreck they begin to form a biofilm, which forms a protective layer between the ship and the seawater," says Damour.

This means that any kind of mechanical impact, such as an anchor dragging across the wreck, will break through that protective crust and open the bare metal to the seawater again, speeding up corrosion.

It is not just mechanical impact that can speed up the corrosion. The 2010 Deepwater Horizon disaster spewed millions of gallons of oil into the Gulf of Mexico, and much of it entered the deep ocean. In laboratory experiments, the team has found that exposure to oil can speed up the corrosion of shipwreck material. This suggests that oil from the Deepwater Horizon spill may be accelerating the corrosion of shipwrecks on the seafloor, but the team have not yet been able to find out if this is really happening.

"Every bacteria, fungus and microbe has a specific function it performs that it has evolved to do over millions of years," says Damour.

These shipwrecks are important historical monuments

"Iron-sulphate-reducing bacteria are attracted to the iron in steel shipwrecks, but others love the hydrocarbons that make up oil, and so these flourished after the 2010 spill. However, we found that not all microbes can handle being exposed to oil and chemical dispersants and some find it extremely toxic. Even four years later, the oil was still present in the environment, and the damaging effect it has on bacteria and biofilms meant the shipwrecks were exposed to seawater and were corroding at a much faster rate."

The finding is alarming. More than 2,000 sunken ships lie on the Gulf's seafloor, including everything from 16th-Century Spanish vessels to the ruins of a World War Two U-boat. These shipwrecks are important historical monuments, which provide unique insight into the past. They also provide a home for deep-sea life.

But eventually, all the shipwrecks – including Titanic out in the Atlantic – will be eaten away entirely, whether through metal-munching bacteria or seawater corrosion. The iron in the 47,000-tonne vessel will end up in the ocean. Eventually, some of it will be incorporated in the bodies of marine animals and plants. The Titanic will have been recycled.

Join over six million BBC Earth fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 5 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital and Travel, delivered to your inbox every Friday.