NEW YORK — A judge awarded $6.7 million Monday to graffiti artists who sued after dozens of spray paintings were destroyed on the walls of dilapidated warehouse buildings torn down to make room for high-rise luxury residences.

U.S. District Judge Frederic Block in Brooklyn said 45 of the 49 paintings were recognized works of art “wrongfully and willfully destroyed” by a remorseless landlord.

Twenty-one aerosol artists sued the owner of a Long Island City, Queens, site known as 5Pointz under the Visual Rights Act, a 1990 federal law that protects artists’ rights even if someone else owns the physical artwork. Their graffiti was painted over in 2013, and the buildings were torn down a year later.

Before they vanished, the graffiti artworks became a tourist attraction, drawing thousands of spectators daily and forming a backdrop to the 2013 movie “Now You See Me,” and a site for an Usher tour, the judge noted.

All the while, the crime-ridden neighborhood gradually improved and it became the “world’s largest collection of quality outdoor aerosol art,” though a system set up by the artists meant some paintings were temporary while others were given permanent status, Block wrote.

The ruling followed a three-week trial in November, when Block said the “respectful, articulate and credible” artists testified about “striking technical and artistic mastery and vision worthy of display in prominent museums if not on the walls of 5Pointz.”

He noted one artist came from London, another from rural West Virginia, while others were products of prestigious art schools. Some were self-taught.

He said he was impressed with the breadth of the artists’ works.