Speculative-fiction writer Harlan Ellison, who penned short stories, novellas and criticism, contributed to TV series including “The Outer Limits,” “Star Trek” and “Babylon 5” and won a notable copyright infringement suit against ABC and Paramount and a settlement in a similar suit over “The Terminator,” has died. He was 84.

Christine Valada tweeted that Ellison’s wife, Susan, had asked her to announce that he died in his sleep Thursday.

Susan Ellison has asked me to announce the passing of writer Harlan Ellison, in his sleep, earlier today. “For a brief time I was here, and for a brief time, I mattered.”—HE, 1934-2018. Arrangements for a celebration of his life are pending. — Christine Valada (@mcvalada) June 28, 2018

The prolific but cantankerous author famously penned the “Star Trek” episode “City on the Edge of Forever,” in which Kirk and Spock must go back in time to Depression-era America to put Earth history back on its rightful course, a goal that for Kirk means sacrificing the woman he loves (played by Joan Collins). The final script was rewritten by “Star Trek” staffers, leaving Ellison unhappy.

His 1995 book “The City on the Edge of Forever: The Original Teleplay That Became the Classic Star Trek Episode” contained two drafts by Ellison.

The author was still steaming over his experience more than four decades after the episode originally aired: In 2009 Ellison sued CBS Paramount Television seeking revenue from merchandising and other sources from the episode; a settlement was reached six months later.

The author of a 1980 L.A. Times profile declared, “Ellison is fiercely independent, proudly elitist, frequently angry, tenacious and downright vengeful.”

Talking about the Hollywood establishment, Ellison told the author, “They’ve got to know that everybody isn’t frightened and won’t back down…. These people are not creators; they belong to the AAA — agents, attorneys and accountants. They aren’t comfortable dealing with writers — they think we’re madmen. They’re really only comfortable dealing with numbers.”

In a separate case, Ellison won $337,000 (later reduced a bit in a settlement) from ABC and Paramount Studios in 1980 for copyright infringement on a short story the author had penned with Ben Bova, “Brillo.” Ellison and Bova had been asked to develop it at ABC, but the option there had lapsed; Ellison then showed it to Par execs, who said they weren’t interested. ABC aired a Par-produced telepic called “Future Cop” in May 1976 and later a brief series of the same name. The premise, about the first android policeman, was identical to that in “Brillo.”

In the litigious writer’s third victory against Hollywood, Ellison sued James Cameron and others behind 1984’s “The Terminator,” claiming that the film drew from material in two episodes of the original “The Outer Limits” series, “Soldier” and “Demon With a Glass Hand,” that he had penned and had aired in 1964. Production company Hemdale and distributor Orion Pictures settled out of court and were required under the terms of the settlement to acknowledge Ellison’s work in the film’s end credits. Cameron, however, labelled Ellison “a parasite.”

Curiously, Ellison had little sympathy for others who brought copyright-infringement suits against the studios, telling the L.A. Times, “You’ve got to realize that there are hundreds of these claims and most of them aren’t valid. This is a town of amateurs…. You have to separate these people and their complaints from the professionals who really work at writing and have viable ideas.”

Born in Painesville, Ohio, Ellison grew up in the only Jewish family in a small town where he said he had to defend himself in physical altercations on a daily basis. During the 1950s Ellison attended Ohio State U. for 18 months, served in the Army and began to sell sci-fi stories to pulp mags.

He moved to California in 1962.

Ellison was famously fired on his first day of employment as a writer at Walt Disney Studios after making highly irreverent suggestions about the company’s beloved characters.

He penned scripts for “Route 66,” “Burke’s Law” and “Voyage to the Bottom of the Sea,” “The Man From U.N.C.L.E.” and even “The Flying Nun.” For a 1964 episode of “The Alfred Hitchcock Hour,” “Memo From Purgatory,” he adapted his own nonfiction memoir about having joined a street gang in Brooklyn.

Ellison also penned the screenplay to tepidly trashy Hollywood melodrama “The Oscar,” and the post-apocalyptic cult classic “A Boy and His Dog” (1975), starring a young Don Johnson, was based on an Ellison novella.

Ellison was also editor of the very influential sci-fi anthologies “Dangerous Visions” and “Again Dangerous Visions.”

When he dealt with Hollywood, he fearlessly said exactly what he thought again and again — often causing fallout as a result. In the wake of the 1977 release of “Star Wars,” a Warner Bros. executive asked Ellison to adapt Isaac Asimov’s short story collection “I, Robot” for the bigscreen.

Ellison penned a script and met with studio chief Robert Shapiro to discuss it; when the author concluded that the executive was commenting on his work without having read it, Ellison claimed to have said to Shapiro that he had “the intellectual capacity of an artichoke.” Needless to say, Ellison was dropped from the project. Ellison’s work was ultimately published with permission of the studio, but the 2004 Will Smith film “I, Robot” was not based on the material Ellison wrote.

Perhaps Ellison’s most famous story not adapted for the screen was 1965’s “Repent, Harlequin! Said the Ticktockman,” which celebrates civil disobedience against a repressive establishment. “Repent” is one of the most reprinted stories ever.

In September 2011, however, Ellison sued to block the release of New Regency’s thriller “In Time,” starring Justin Timberlake, claiming that the film hews too closely to “Repent,” then dropped the suit. In the early 1970s, Ellison created his only TV series, the Canada-produced “The Starlost.” He was so unhappy with the changes made by producers, however, that he took his name off the skein, which aired in 1973.

Ellison was a creative consultant for the 1980s edition of “The Twilight Zone,” for which he wrote several episodes, and was conceptual consultant for the 1990s sci-fi series “Babylon 5.” He also appeared in several episodes.

In 1995 Ellison adapted his story “I Have No Mouth, and I Must Scream” for the videogame of that name. He was also credited with design of the game and voiced the main character.

“Dreams With Sharp Teeth,” a documentary centering on Ellison and his work, received a theatrical release in 2008. Interviewees included Ellison and Robin Williams. Ellison also appeared in other documentaries, including “The Masters of Comic Book Art,” “Shadows in the Dark: The Val Lewton Legacy,” “Brother Theodore” (2007) and “With Great Power: The Stan Lee Story” (2010).

In addition to numerous genre awards — including multiple Hugos, Nebulas and Edgars — Ellison received four WGA Awards for his TV work and the Silver Pen for Journalism, conferred by international writers union PEN, for his “An Edge in My Voice” column in the L.A. Weekly in defense of First Amendment rights.

Despite the kudos he amassed, however, Ellison penned a guest column for Variety in November 2013 in which he declared: “I do not merely hate all awards shows, I wish to see them beheaded, stakes driven through their black and corrupted widdle hearts, and to see the decapitated remains buried at a crossroads come midnight.”

Ellison was married five times, with at least two of those marriages lasting only weeks or months. Survivors include his fifth wife, Susan Ann Toth.