The National Security Agency and the Department of Homeland Security acknowledged in a settlement made public Tuesday that they were wrong to ban a leading custom-merchandise retailer from selling t-shirts, mugs, and posters that poked fun at the agencies.

The agreement puts to rest a First Amendment lawsuit against the federal government brought last year by a t-shirt designer, Dan McCall, who hawked merchandise on Zazzle.com that parodied the official seal of the NSA with jokes referencing the spy program disclosures. Another design imprinted on mugs featured a look-alike Homeland Security logo for a "Department of Homeland Stupidity."

Mr. McCall's lawsuit, which Law Blog wrote about earlier, came in response to cease-and-desist letters that the NSA and Homeland Security sent to Zazzle in 2011, ordering the retailer to remove the parody products from its site or face legal action.

NSA's cease-and-desist letter claimed the products violated a provision of the National Security Agency Act of 1959 that limits the commercial use of NSA official seals -- and also the words 'National Security Agency' and the initials 'NSA' -- without the agency's permission. Homeland Security's letter to Zazzle cited three separate criminal statutes.

As part of the settlement, the NSA agreed to write another letter to Zazzle acknowledging that Mr. McCall's images were intended as parody and "should not have been viewed as conveying the impression that the designs were approved, endorsed, or authorized by NSA," according to the agreement.