KENSINGTON, MD -- Master builders of the sea construct the equivalent of a complex five-story house that protects them from predators and funnels and filters food for them -- all from snot coming out of their heads.

And when these delicate mucus homes get clogged, the tadpole-looking critters -- called giant larvaceans -- build a new one. Usually every day or so.

These so-called "snot palaces" could possibly help human construction if scientists manage to crack the mucus architectural code, said Kakani Katija, a bioengineer at Monterey Bay Aquarium Research Institute.

Her team took a step toward solving the mystery of the snot houses and maybe someday even replicating them, according to a study in Wednesday's journal Nature.

The creatures inside these houses may be small -- the biggest are around 4 inches (10 centimetres) -- but they are smart and crucial to Earth's environment. Found globally, they are the closest relatives to humans without a backbone, Katija and other scientists said.

Together with their houses "they are like an alien life form, made almost entirely out of water, yet crafted with complexity and purpose," said Dalhousie University marine biologist Boris Worm, who wasn't part of the study. "They remind me of a cross between a living veil and a high tech filter pump."

Also, when they abandon their clogged homes about every day, the creatures collectively drop millions of tons of carbon to the seafloor, where it stays, preventing further global warming, Worm said. They also take microplastics out of the water column and dump it on the sea floor. And if that's not enough, the other waste in their abandoned houses is eaten by the ocean's bottom dwellers.

But it's what they build that fascinates and mystifies scientists. Because the snot houses are so delicate, researchers haven't often been able to take them to the lab to study them. So Katija and team used a remote submarine, cameras and lasers to watch these creatures in water about 650 to 1300 feet (200 to 400 metres) deep off Monterey Bay in Northern California.

These mucus structures aren't simple. They include two heart-like chambers that act as a maze for the food that drifts in, except there's only one way for it to go: into the larvacean's mouth. The snot houses often are nearly transparent and flow all around the critter that looks like a tadpole, but isn't.

"It could be the most kind of complex structure that an animal makes," Katija said. "It's pretty astonishing that a single animal is able to do it."

And the houses are comparatively big -- about 10 times bigger than the critters themselves -- reaching more than three feet wide (one meter). It would be the equivalent of a person making a five-story house, Katija said.

"They create these small versions of houses by secreting mucus from cells on their heads and then expand those much like a balloon into the structures that we see," Katija said. All in about an hour.

Water can flow through the structure so that when it moves through the water it doesn't give much of a motion detectable by predatory fish. That, Katija said, essentially masks the house from whatever wants to eat the larvaceans.

NASA engineers looking to build structures on the moon would probably like to learn from the larvaceans, she said.

None of this could be done in the lab. Katija's team used 3D laser scan technology to virtually fly through the inner chambers of the snot palaces, then recreated them with software to model the inner-workings of the structure. But she said the scientists are still far from understanding everything going on there.

Providence College biologist Jack Costello, who wasn't part of the study, said Katija's team did "really cool work ... to detail the complex houses. It's not easy to do in the best circumstances and they've done it deep in the oceans."

"We have a lot to learn," Costello said. "I'm in awe of these animals."

Follow Seth Borenstein on Twitter: @borenbears

The Associated Press Health and Science Department receives support from the Howard Hughes Medical Institute's Department of Science Education. The AP is solely responsible for all content.