Massachusetts Democratic Rep. Barney Frank is apologizing for an off-handed comment he made about the Trayvon Martin case during a graduation ceremony Sunday.

"You now have a hoodie you can wear and no one will shoot at you," Frank said after black civil rights leader Hubie Jones received a hooded academic robe as part of an honorary degree awarded by the University of Massachusetts Dartmouth.

“I think you’ll feel pretty protected by that,” Frank added.

The comment drew groans from the crowd.

Martin was the Florida teen who was wearing a hoodie when he was shot and killed by a neighborhood watch activist.

More On This...

The retiring congressman said he has used the line at other graduation ceremonies and that it was meant to "ridicule the notion that a hooded sweatshirt is somehow sinister."

Jones said he didn't think Frank meant any harm.

Campus Chancellor Jean F. MacCormack introduced Frank as a “long-time champion of fairness” with “uncommon wit.”

The Associated Press contributed to this report.