A Massachusetts man under investigation in the hacking of a Boston hospital was rescued from a sailboat off the coast of Cuba by a Disney cruise ship and arrested Wednesday, weeks after relatives told police they had last heard from him, authorities said.

Martin Gottesfeld and his wife made a distress call Tuesday from a sailboat and were picked up by the nearby ship, federal prosecutors said.

Gottesfeld, 31, of Somerville, was arrested Wednesday on a conspiracy charge after the Disney ship returned to Miami. He's charged in a 2014 computer attack at Boston Children's Hospital in the name of the hacking group Anonymous.

Prosecutors say the FBI searched Gottesfeld's home in 2014, so he knew about the federal investigation.

Last week, the FBI learned that Somerville police did not find Gottesfeld during a well-being check at his apartment after his employer and family members reported they hadn't heard from him in weeks.

Then on Tuesday, an FBI agent in the Bahamas called the FBI's Boston office to report that Gottesfeld and his wife were on a Disney Cruise Line ship in the Bahamas after being picked up not far from Cuba. The couple had luggage and three laptop computers with them.

Authorities say the computer attack was in protest of the hospital's treatment of Justina Pelletier, a Connecticut teenager who was at the center of a custody dispute based on conflicting medical diagnoses.

Tufts Medical Center had treated Justina for mitochondrial disease, a disorder that affects cellular energy production. But Boston Children's Hospital later diagnosed her problems as psychiatric. When Justina's parents rejected that diagnosis and tried to take her back to Tufts, the Massachusetts Department of Children and Families took custody of her, setting off a bitter dispute.

Justina's case drew national media attention as various groups cited it as an example of governmental interference with parental rights.

An affidavit filed in court by an FBI agent said that on March 23, 2014, a video was posted on YouTube calling for action against a Massachusetts hospital in response to its treatment of her. The girl was not identified in the FBI affidavit, but Children's Hospital confirmed at the time that its computer network had been attacked over the Pelletier case.

The video was narrated by a computer-generated voice and stated that Anonymous "will punish all those held accountable and will not relent until (Justina) is free."

The video directed viewers to a posting on the website that contained necessary information about the hospital's server to initiate an attack against it.

On April 19, 2014, the hospital reported an attack against the server identified in the posting. The attack disrupted the hospital's network, took its website out of service and cost more than $300,000 to respond to and mitigate, according to the affidavit.

During a search of his home in October 2014, Gottesfeld admitted posting the video but denied participating in any attacks, the FBI agent said in an affidavit.

Tor Ekeland, a New York attorney who represents Gottesfeld, declined to comment, saying he hadn't had a chance to review the criminal complaint or speak to Gottesfeld.

Gottesfeld is charged with conspiracy to intentionally cause damage to protected computers. During an initial appearance Wednesday in U.S. District Court in Miami, he agreed to voluntary detention pending a hearing in U.S. District Court in Boston. No date has been set yet for that hearing.

Representatives for Children's Hospital and Disney Cruise Line did not return calls seeking comment.

Click for more from Fox 61.