Derek Medina appeared to live much of his life online.

The 6-foot-2, 200-pound South Miami resident posted photos and videos of himself kickboxing, sailing, meeting celebrities and wearing a Miami Heat championship ring. In one Facebook photo, he mugged for the camera holding a knife and a gun and wearing a green camouflage vest.

There was also what he called his “emotional” side: One of the six e-books the 31-year-old wrote and promoted on his website discussed the importance of communication to a good marriage.

On Thursday, however, Medina’s Web-based persona took a nefarious turn.

First he apparently posted a message on his page in which he confessed to killing his 26-year-old wife, Jennifer Alfonso. Moments later, a gruesome photo appeared on the page: a woman wearing black leotards slumped over on the floor with blood on her face and arm, her knees bent and her legs bent back behind her.

Several hours later, Facebook officials had taken down the page and Medina had turned himself in to police.

Wearing a green jumpsuit, he appeared via video Friday before Miami Judge Maria Elena Verde, who ordered him held without bond on a first-degree murder charge. He is being represented by the public defender’s office. A lawyer from the office told him to not discuss the case with anyone.

Medina was being held on the ninth-floor psychiatric ward of Miami-Dade County Jail and wore a padded gown for inmates on suicide watch. Two corrections officers flanked Medina as he told an assistant public defender: “I’m in the process of talking to someone,” he said, apparently a reference to hiring a lawyer, although he could not clarify to the judge.

For now, the public defender’s office will represent Medina, who will be set for an arraignment in 21 days.

No relatives appeared in court on his behalf. For a charge of first-degree murder, Miami-Dade prosecutors must take his case to a grand jury.

Neither Medina nor Alfonso had criminal records prior to her death, although their relationship appeared rocky.

Public records show they first married in January 2010, divorced in February 2012, then remarried three months later. In March 2012, Medina bought the couple’s condominium unit for $107,000.

Medina seemed to share some of these experiences in a 41-page e-book titled “How I Saved Someone’s Life and Marriage and Family Problems Thru Communication,” which recounts the marriage of a man and a woman who divorced, then remarried — and in between times had frightening encounters with aliens and ghosts.

“The author was with his wife in New York and his wife was attacked by a ghost,” Medina wrote on a personal blog. “She was seeing a ghost and was being taunted and messed with. She informed her husband and he told her to go to sleep and he would watch over her. Minutes later he was attacked by a demon ghost and he was sick and throwing up.”

A self-described fan of ghost hunting, Medina wrote on his Facebook page that he and Alfonso had once searched for ghouls in Florida and Louisiana. Other adventures included an encounter with bats in a cave in the Bahamas. A video he posted shows Medina throwing an object at the winged mammals before they fly toward him.

Acting was also a part of his life, according to Medina, who claimed to have appeared in the Miami-based crime drama “Burn Notice,” though his name doesn’t appear in online credits for the show.

His work life, according to his Facebook page, included a job as property management supervisor at The Gables Club, a gated, upscale condominium complex in Coral Gables.

A maintenance worker, who would not give his name, said he had seen Medina working at the front desk, taking care of calls and the tenants. He said was “a very nice guy, polite.”