Visitors to the Portobello Aquarium loved Sid the octopus but all Sid wanted was to find a mate. After several escape attempts worthy of Houdini, he finally tasted freedom yesterday, with his keepers returning him to the ocean just in time for Valentine's Day.

The aquarium, near Dunedin, on New Zealand's South Island, was Sid's home for the past six months. At first, he seemed quite content there. He would move around his tank, exploring his new environment, and would change colour, as octopuses do. But, shortly after Christmas, he developed itchy feet – or tentacles.

Matthew Crane, Portobello's senior aquarist, came in one morning to find Sid gone. Staff looked high and low. One of his tank's sliding plastic doors was ajar but it was not clear whether someone had left it open by mistake, or whether he had opened it himself. Five days later, he was found inside a drainage system that pumps sea water through the aquarium. He was trying to sidle out through a door.

Download the new Independent Premium app Sharing the full story, not just the headlines

A few weeks later, Sid made a second dash for freedom. Again, his door was found ajar. Located a few hours later, he made several more escape attempts, usually when his tank was being cleaned. Staff would see one tentacle emerge from the tank, then another. "We thought he must be actively seeking a mate," said Mr Crane. "So we decided it might be best to let him go back to nature."

Yesterday afternoon, Mr Crane transferred Sid to a plastic bucket and carried him to the water's edge, 300 yards away. Even during that short walk, Sid was trying to lift the lid off the bucket. Then he was ceremoniously dumped in the ocean. "We watched him swim away," said Mr Crane. "He was a good healthy colour and he looked quite happy."

Octopuses live for about two years, and breed towards the end of their life cycle. So Sid, who was about nine months old when caught, would be of an age now to be looking for love. Mr Crane wishes him every success. "He's a common octopus, so we're pretty confident he'll find a mate. It's a species that's often seen in the harbour."

Mr Crane said that Sid might have watched the door to his tank being opened often enough to figure out how to do it himself. Or, after it was left ajar the first time, he might have realised it was a means of escape. "An octopus is quite intelligent, so it's not beyond the scope of believability," Mr Crane said. "Some people compare them with dogs, because you can train them to open a jar, for instance, particularly if it's got a crab in it."

A few years ago, he said, crayfish kept disappearing from the aquarium. Staff were perplexed, and blamed impecunious marine biology students. Then, one night, one of Sid's predecessors was caught in the act. He climbed out of his tank, stole the crayfish, replaced the lid on the crayfish tank, then returned to his own tank, shutting the door behind him.

A research laboratory reported a similar story, with a security camera filming an octopus stealing fish from a neighbouring tank and then covering his tracks. Ten years ago, an octopus escaped from the same tank that housed Sid, and was found halfway up a staircase. He was nicknamed Harry, after Harry Houdini. Octopus, like squid, have courtship rituals, which include changing colour. Mr Crane said he had seen squid "split themselves in half, colour-wise, with one half an attractive light colour to appeal to a mate and the other half an aggressive dark red colour to chase away other males".

The aquarium has put out fresh pots to catch a replacement for its wandering would-be Lothario.

The clever clogs of the ocean floor

*Octopuses are considered to be one of the most intelligent marine species. Their brain is the largest and most advanced of any invertebrate.

*Until recently, it was widely believed that they had eight arms. However, last year a European study discovered that they actually have six arms and two legs. They use their rearmost tentacles to push off from the surface of the sea bed before propelling themselves through the water with the other limbs.

*During the same experiment, it was discovered that the animals could perform complex tasks with their arms, such as manipulating a Rubik's cube. Uniquely, octopuses have more than half their nerves in their arms and even partially think with them.

*It is believed that an octopus's memory and learning capabilitycan be compared in complexity to that of advanced vertebrates – a number of octopuses have been taught to unscrew jars or bottles to get at food.