It’s legal to parody the logos of the National Security Agency and the Department of Homeland Security, the government conceded in a settlement agreement announced Tuesday.

The agreement ends a lawsuit filed on behalf of Dan McCall, a graphic designer whose work was removed from the online marketplace Zazzle.com in 2011 after the agencies sent cease and desist orders that alleged his mugs and T-shirts violated trademark law.

“You would expect that at a government agency there would be a grown-up looking on to make sure stupid letters like these weren’t going out,” says Public Citizen Litigation Group attorney Paul Levy, who represented McCall. “Obviously in this case there was no grown-up.”

Levy says it’s legal to parody a trademark if it’s clear the work does not convey an endorsement from the trademark holder. He defeated Wal-Mart in 2008 when the retail behemoth alleged activist/artist Charles Smith violated trademark law with websites and merchandise denouncing “Wal-Qaeda” and “Wal-ocaust.”

In addition to agreeing to rescind takedown notices sent to Zazzle, the government agreed to pay McCall $500 as compensation for basic lawsuit expenses.

Levy says the First Amendment clearly applies to the items produced by McCall, which featured tweaked logos with humorous quips about domestic surveillance and the intelligence of government workers.

In a March 2011 letter, the NSA told Zazzle the merchandise – including NSA-themed mugs reading “Spying on you since 1952” and shirts that said “Peeping While You’re Sleeping” -- violated federal law by “convey[ing] the impression that such use is approved, endorsed, or authorized by the National Security Agency.”

DHS joined the fray in August 2011, warning Zazzle “fines and/or imprisonment” were possible for violating a law that makes it a crime to “falsely make, forge, counterfeit, mutilate, or alter the seal of any department or agency of the United States.” Zazzle then removed the anti-NSA items, as well as an anti-DHS shirt that read “Department of Homeland Stupidity.”

Original copies of the takedown orders were not acquired by McCall or Levy. Zazzle would not provide copies, Levy says, but rather read the directives to him over the phone. As part of the settlement agreement, the government will provide Public Citizen with copies, which the group intends to post online.

After Zazzle removed his merchandise, McCall began hawking the items on CafePress.com. Neither CafePress nor McCaul received cease and desist orders.

“I think he would have given them the finger if they sent him a takedown notice,” Levy says.