A pedestrian walks past an advertising placard for the movie “Fifty Shades of Grey,” which had an advance screening at the 65th Berlinale International Film Festival in Berlin on Feb. 4. (Fabrizio Bensch/Reuters)

The most scandalous part of “Fifty Shades of Grey” isn’t what Christian Grey does behind closed doors. It’s that the book might well be illegal art.

The movie’s dubious legal status stems from its origins: The popular novel by E.L. James began its life as unauthorized, online fan fiction based on Stephenie Meyer’s bestselling (and comparatively chaste) romance series “Twilight.”

Meyer’s copyright in “Twilight” grants her not only the exclusive right to make copies of her novel, but also the exclusive right to decide who can “prepare derivative works” of her novel. The “derivative work right” is the reason Summit Entertainment needed permission from Meyer to adapt the “Twilight” series into film. It also encompasses new works, such as sequels or alternate histories based on an original piece’s characters and setting.

This is where the legal status of “Fifty Shades of Grey” gets murky. The work was originally posted as unauthorized fan fiction online, under the title “Master of the Universe.” Its main characters, initially, were named Edward and Bella after the primary characters in “Twilight.” “Master of the Universe” explored what Edward and Bella’s relationship might look like if, instead of being a celibate vampire, Edward was a decidedly prurient human businessman. The popularity of “Master of the Universe” led to a seven-figure book deal.

James renamed the characters, but she didn’t rewrite the book. Blogger Jane Litte ran Master of the Universe and Fifty Shades of Grey through the anti-plagiarism software Turnitin, and concluded that 89 percent of the text was identical. Still, James’s current publisher, Vintage, maintains that “Fifty Shades” is original and no longer based on “Twilight.”

But there is widespread disagreement about how far the derivative work right reaches. Many past cases indicate that “Fifty Shades” at least arguably constitutes an illegal infringement of Meyer’s “Twilight” series. In 2010, a federal appellate court held that an unauthorized sequel to J.D. Salinger’s “Catcher in the Rye” probably infringed on Salinger’s famous work — that book, “Sixty Years Later: Coming Through the Rye,” is now banned in the United States. Back in 1978, Twentieth Century Fox filed a lawsuit alleging that the “Battlestar Galactica” series infringed upon the “Star Wars” copyright. (The two works share similar plots, themes, settings and characters.)

More than four years later, a federal appellate court held that the issue was “a close enough question that it should be resolved by way of a trial.” While the case ended up settling before a court reached a final decision, the makers of “Battlestar Galactica” had to defend the legality of their work for nearly half a decade.

In this case, the legal issue hasn’t mattered. Aside from saying that “Fifty Shades” is “too smutty” for her tastes, Meyer hasn’t taken any action against E.L. James. (The “Twilight” author has generally not objected to fan fiction based on her novels.) But Meyer never affirmatively granted James a license to write a novel derivative of “Twilight,” either. So “Fifty Shades” may be an infringing derivative work. Copyright protection lasts a long time, and Meyer’s heirs might have different opinions. Moreover, under current copyright law, unauthorized derivative works are not only infringing, but also are ineligible to receive a copyright themselves.

This is absurd.

According to the Constitution, copyright protection exists to promote the “progress of science” — a term understood to mean “knowledge” in the late 1700s. Progress can be promoted by granting copyrights, which give authors incentives to create and an increased ability to earn an income from their projects. But the store of human knowledge also grows when the public is permitted to use the culture around them to develop ideas. “Fifty Shades of Grey” makes the sexual subtext and power dynamics of “Twilight” plain. Although it is easy to dismiss both novels as frivolous fiction, they both have become major parts of a society-wide conversation about what sex and relationships should look like.

The fact that both novels are runaway bestsellers — and that both novels have been so heavily criticized — illustrates their importance to that discussion.”Fifty Shades of Grey,” “Coming Through the Rye” and most fan fiction should not constitute illegal art. Wrestling with social mores through literature is too necessary to permit copyright law to limit it. Powerful ideas are often better expressed in reference to existing and familiar sources — for example, the popular fan fiction “Harry Potter and the Methods of Rationality” uses an alternative vision of the magical Harry Potter universe to explain complex concepts in cognitive science and philosophy.

The solution is simple. Certainly, new artists who riff off existing works should be required to disclaim association with the original authors and publishers. However, when it comes to the substance of works, courts should permit unauthorized stories that don’t merely restate another work but rather build — and effectively comment — on existing characters and settings. Courts have the power to read the derivative work right narrowly and fair use protections broadly, and they should exercise their judgment to do so.

Protecting new artists’ freedom to engage with culture preserves authors’ protection from piracy and slavish copying but allows new authors to stand on the shoulders of giants. Works such as “Fifty Shades of Grey,” “Coming Through the Rye” and “Methods of Rationality” aren’t works of piracy, but new works of art that communicate, build on and respond to some of the most salient parts of our culture. Their legal status should be clear and celebrated, rather than clouded in shades of grey.