Blake Leibel was fascinated by evil.

His graphic novel centered on the search for the bad seed lurking in the brains of serial killers. He wrote a screenplay about a madman on a murder spree. His work, he wrote online, “grappled with the questions surrounding what provokes a person to commit evil acts.”

Now Leibel stands accused of taking that fascination too far by reenacting his bloody imagination in real life.

On Tuesday, the 35-year-old appeared in a Los Angeles courtroom to face charges of torturing, mutilating and killing his girlfriend.

Leibel was arrested in West Hollywood on Thursday when authorities discovered his girlfriend’s body inside their barricaded apartment, according to the Associated Press.

Iana Kasian, 30, had just given birth to their first child three weeks earlier.

In a detail seemingly pulled from Leibel’s own graphic novel, prosecutors said her body had been “drained” of its blood.

Leibel has pleaded not guilty. If convicted of first-degree murder, he could face the death penalty, the AP reported.

Such a sentence would be a bizarre and ironic twist for the graphic novelist, whose best-known work begins with the execution of a serial killer on death row.

It would also mark a sudden and precipitous fall for Leibel, the son of a wealthy Toronto developer and former Olympian.

Just two weeks ago, Leibel seemed to have it all: a beautiful girlfriend, a baby boy, a family fortune and a foothold in Hollywood.

Leibel grew up in Toronto in one of the city’s wealthier families. His father, Lorne, is a successful businessman and bon vivant. He competed on Canada’s sailing team in the 1976 Olympics before making a fortune building suburban homes in the 1980s and 1990s, according to the National Post. At one point, his company, Canada Homes, was the country’s largest home builder. Lorne Leibel describes himself as a “well known Ferrari man and famous racer.”

Blake Leibel’s mother brought her own money to the marriage as the heiress to a plastics fortune. She and Lorne had two sons: Blake and Cody. With his round cheeks and angular chin, Blake was the spitting image of his debonair dad.

Both Leibel boys eventually moved to Los Angeles, with Blake arriving in 2004, according to the Los Angeles Times. There, however, they took very different paths.

Cody followed into their father’s footsteps by becoming a real estate developer, according to the Times.

But Blake had less-lucrative interests.

Instead of building houses, he enjoyed blowing stuff up in video games. And he was good at it.

Leibel “won world championships” in the first-person-shooter game “Half-Life,” according to his Tumblr, which also describes him as “an avid gamer with the ultimate goal of creating his own massively multiplayer online (MMO) game.”

Propped up by a nearly $18,000 per month allowance from his parents, Leibel gradually moved from gaming into other branches of the entertainment industry. In 2008, he worked on an animated-series version of the Mel Brook’s movie “Spaceballs,” according to Leibel’s IMDb page. That same year he got involved in “a comic book space opera” series called “United Free Worlds,” complete with aliens, dinosaurs, interstellar warfare and a Conan the Barbarian-like hero clad in a loincloth. He also wrote and directed a comedy called “Bald.” Its poster features a hairless man flanked by four blondes in bikinis. Its subtitle: “No Money. No Hair. No Shame.”

Graphic novelist Blake Leibel gave this interview during New York Comic Con in 2008. Leibel is accused of torturing, mutilating and killing his girlfriend. (Gorillawire TV)

The closest Leibel came to critical acclaim was two years later when he published “Syndrome.”

Leibel described it as “a lengthy graphic novel that grappled with the questions surrounding what provokes a person to commit evil acts.”

Its opening scene is, in hindsight, chilling: A television news reporter stands outside a prison on the eve of a serial killer’s execution.

“Why are you here, standing against the lawful sentence of this monster who preyed on women and church-going families?” the reporter asks a woman protesting the execution.

“Hold it right there,” the protester answers. “How can he be a monster if he’s made in the image of god?”

The graphic novel then cuts to images of the serial killer hanging a naked couple from their ankles and slashing their throats — draining them of blood.

“Syndrome” centers around a “rogue neuropathologist [who] makes a startling breakthrough — literally isolating the root of all evil in the recesses of the human brain — [and] he’ll stop at nothing to advance his theory,” according to a publisher’s description on Amazon.com. “With the help of a naive Hollywood actress, a tormented motion picture director, and a condemned serial killer, Dr. Wolfe Brunswick launches a bold experiment in the Nevada desert, the outcome of which could transform humanity forever.”

Early in the graphic novel, the serial killer describes the sexual gratification he derived from killing.

“You should try it,” he tells the doctor.

“With “Syndrome,” Blake Leibel, who created the concept, just sort of posed a couple of provocative questions to us — especially about how one would actually treat, as opposed to simply punish, an actual, bona fide psychopath — and then gave us the freedom to find the answers through our storytelling,” co-author R.J. Ryan told an industry publication.

Evil and psychopathy were recurring themes for Leibel. Shortly after the publication of “Syndrome,” he wrote a screenplay called “Psychopomp” about “a profanity spewing madman who travels in and out of international hot spots looking to kill anyone who goes against his personal code of conduct,” according to MovieWeb.

But in recent years, Leibel’s own life had started to unravel. When his mother died in 2011, he said in court documents that he had no income even though he was already supporting a wife and a son, according to the Times. And in a 2014 court battle to get more of his family’s fortune, he said his relationship with his father was “bitter,” according to Global News.

Leibel filed for divorce from his wife last year, although the case is still pending in court, the Times reported.

It’s unclear when, exactly, he met Kasian. The raven-haired woman had moved to L.A. in 2014 from her native Ukraine, where she had studied law and worked in tax inspection, according to the National Post.

Kasian appeared to be enamored of Hollywood. In photos posted to Facebook, the 30-year-old posed for what appears to be professional advertisements as well as a selfie snapped in front of the city’s celebrity star-lined sidewalk.

She gave birth to their son May 3.

It was shortly thereafter that their life descended into one of Leibel’s twisted graphic novels.

Just after midnight May 20, Leibel was arrested on suspicion of sexual assault, according to the Times. He was released on $100,000 bail, jail records show.

Kasian was not his alleged victim, though, a family friend told the National Post.

Leibel’s arrest just 17 days after his girlfriend gave birth apparently shattered their relationship. Kasian moved out of their West Hollywood apartment and in with her mother.

Then, last Tuesday, Kasian went back to her apartment to talk to Leibel.

She never returned.

After her mother contacted the West Hollywood sheriff’s station, deputies arrived at the apartment only to find its door barricaded shut with furniture and bedding. When they finally managed to speak to Leibel, he seemed “agitated and uncooperative,” Los Angeles Sheriff Lt. Dave Coleman told reporters.

Inside the bedroom, deputies found Kasian dead from “sustained blunt force trauma to her head,” according to a police statement.

“Kasian was tortured and mutilated before she was killed and all of her blood was drained from her body,” the Los Angeles County district attorney said.

Alex Hanley, a neighbor, told Global News that several people in the building heard screams but that they couldn’t tell whether it was a person or a television program.

Prosecutors charged Leibel with one count each of murder, mayhem, aggravated mayhem and torture.

On Tuesday, the graphic novelist, whose works so eerily foreshadowed the crimes of which he is now accused, appeared in court in a padded suicide-prevention jacket, handcuffs and chains wrapped around his waist.

Leibel’s attorney, Alaleh Kamran, raised questions about her client’s mental competence, prompting Los Angeles Superior Court Judge Keith Schwartz to order a psychological evaluation, according to the National Post.

Leibel entered a plea of not guilty on all counts. He is being held without bail.

Prosecutors said they will decide at a later date whether to seek the death penalty.