Climate change, pollution, and unsustainable fishing practices have threatened the world’s largest coral structure but there’s some hope for Australia’s Great Barrier Reef. An intelligent robot is ready to protect it.

Researchers have developed a robot that seeks out and kills one of the leading cause of coral loss—the crown-of-thorns starfish (COTS). This starfish is responsible for 42% of the reef’s total decline in coral cover. Human divers try to eradicate them by administering lethal injections by hand, but as co-researcher Matthew Dunbabin points out, “there just aren’t enough divers to cover all the COTS hotspots across the Great Barrier Reef.”

The robot—named COTSbot—is equipped with cameras, GPS, five thrusters, an injection arm, and sensors to roam the reef for up to eight hours at a time, using its extendable arm to deliver more than 200 lethal shots of poisonous bile salts. The injected starfish die within 24 hours.

Researchers spent months developing the machine-learning system and training the autonomous underwater vehicle to recognize the starfish accurately by showing it images of COTS and non-COTS. Researchers claim the robot identified its target 99.4% of the time in laboratory tests, even ignoring 3D-printed decoys.

Scientists have been turning to robots and, in some cases, even drones, to overcome the limitation of human divers, get a better understanding of the sea, and boost conservation efforts. The US Navy recently funded a drone, which they call the “Naviator,” that can swim as well as fly. Researchers hope to use the drone to monitor oil spills and defuse underwater mines but for now, it remains tethered to its controls.