In the time before "The Sopranos," "Sex and the City" and all that followed, HBO's prestige came from its movies and miniseries. In the '80s and '90s, when those formats were still wildly popular for the broadcast networks, HBO managed to distinguish itself with great dramas about social issues (the AIDS epidemic epic "And the Band Played On"), ruthless satire (the Wall Street comedy "Barbarians at the Gate") or even straight-up comedies (the minor league film "Long Gone," which some hardcore baseball fans prefer to "Bull Durham").

Slowly but surely, the rest of television got out of this particular part of the business, until only HBO was left standing, even though the movies had started to play second fiddle to what Carrie Bradshaw or Nate Fisher were up to. HBO dominated the movie and mini Emmy categories in the '00s, but more because they were the only game in town than because the new output was as good as the old stuff. The miniseries are still capable of greatness, but at a certain point, HBO Films hit on a rigid formula for the movies and stuck to it: 90 minutes — rarely enough to properly touch on any subject — about the life of a celebrity or political figure, with a meaty enough role to get an A-lister like Al Pacino to spend a few weeks acting for television, for a movie that would be satisfying but never as good as the sum of its parts. There's an assembly line quality to the whole endeavor, without much imagination or innovation.

So it's not a surprise that the best HBO movie in forever is one that began life away from the pay cable channel: "Behind the Candelabra" (Sunday at 9 p.m.) the story of late-period Liberace (Michael Douglas) and the relationship he had with young Scott Thorson (Matt Damon). Directed by Steven Soderbergh — in what is allegedly his last film before "retirement" — and written by Richard LaGravenese, it was a star-studded package deal that could find no takers at any movie studio, because (at least according to Soderbergh) executives were worried about the commercial viability of a very sexually frank gay love story, even with two Oscar-winning leads.

So Soderbergh sought independent financing before teaming up with HBO. He clearly had more autonomy than your average HBO filmmaker, if only because this one is two hours and takes advantage of every added minute to really sketch in the ups and downs of the Liberace/Thorson relationship.

Because Liberace was such a well-known, campy personality, there's a danger that Douglas (or Robin Williams, who was attached to the role at a much earlier stage) could just be turning in a broad impersonation. Douglas doesn't play things small. The film features too many scenes of Liberace on stage, gracefully tickling the ivories and flirting with all the women in the audience who had no idea about his sexuality, for Douglas to get away with anything less than full commitment. But because so much of the movie is made up of long, intimate conversations between Liberace and Scott — most of them honest, some of them manipulation that Liberace uses to keep his young lover docile — it feels like Douglas is playing a three-dimensional human being, rather than just imitating a kitsch icon. It's a great performance, and one that should lead him to dominating the TV awards circuit for the next year.

Damon is much too old to play Thorson, who first met Liberace in his late teens, yet the part — and some smart hair and makeup choices — brings out his boyish qualities, in a performance that, like much of the movie, evokes "Boogie Nights." For a good chunk of the running time, Damon has to wear facial prosthetics to portray the plastic surgery Scott was pressured to get — courtesy of a darkly hilarious, stony-eyed plastic surgeon played by Rob Lowe — to resemble the young Liberace, and it makes him appear both sad and ludicrous at the same time.

"Behind the Candelabra" is aware of both the glamor of Liberace's stage persona and lifestyle, and of the emotional cost and narcissism behind it. There are shopping montages and performance montages and loving photography of every jewel-encrusted corner of Liberace's home, just as the film keeps track of the rings Scott winds up selling to fuel the drug habit he develops after his face is transformed. When Scott first visits Liberace in his Vegas dressing room, Liberace's current lover Billy Leatherwood (Cheyenne Jackson) smokes silently in the background, well aware that his replacement has just arrived; it's no surprise when, several years down the line, Scott is the one bitterly gripping his cigarette.

Though Lowe's the standout among the supporting cast, Soderbergh deftly uses familiar actors to quickly make a point: Debbie Reynolds' as Liberace's mother, Dan Aykroyd as his blunt manager, Scott Bakula as an ex-boyfriend/mentor of Scott's (warning Scott to go along with whatever Liberace wants, he tells him, "Honey, in gay years, you're Judy during the Sid Luft obese period"), Paul Reiser as the lawyer trying to win Scott's palimony suit in an era when Liberace was deep in the closet, and Mike O'Malley as a calm fixer, among others.

The film has interesting things to say about Liberace's decision and ability ("People only see what they want to see, Scott") to keep his sexuality a secret, to the point where even after his death his team was trying to conceal that he died from AIDS complications. But it's ultimately about this relationship — both the good and the bad of it — and Soderbergh and company tell it very, very well.

In terms of subject matter and cast, "Behind the Candelabra" isn't that big a departure from what HBO's been doing of late. The execution is just vastly better. This doesn't feel like a factory product, but a work of individual, beautiful craftsmanship. If the movie dominates awards talk as much as I expect it to, I hope its success will convince HBO to both lighten the reins on its filmmakers and also seek out top people like Soderbergh and ask if they have a passion project no one else will make.

It's rare that I hate an HBO movie, but it's been a long time since I loved one. Until now.

Alan Sepinwall may be reached at sepinwall@hitfix.com