A group of Massachusetts police officers who traveled to Cape Cod Tuesday to attend the wake of a cop killed in the line of duty are hailing an anonymous woman who picked up their dinner bill on the way home.

The officers from Chelsea said the act of kindness happened at Mama Mia’s restaurant in Plymouth.

“When we went to pay the check we were presented with a bill marked PAID and a note saying ‘Thanks, my brother is a detective in Miami’,” one of the officers, Paul John, posted on Facebook.

“What an amazing gesture of gratitude, respect and kindness,” he added. “I do not know who you are but I hope that someone shares this Post with you so that you know how important your kindness was to all of us. God Bless You.”

Thousands of police officers and other mourners attended the wake of Officer Sean Gannon, 32, on Tuesday at the St. Pius X Church in Yarmouth.

“Women, children, men and boys, every one of them was quiet, respectful. The first time I think I could I think hear a pin drop and you could hear it on Route 28,” Yarmouth Police Chief Frank Frederickson told Fox 25 Boston.

Gannon was shot last Thursday while he and other officers were serving an arrest warrant at a home in Barnstable. The suspect in the shooting, identified as Tom Latanowich, 29, of Somerville, Mass. -- who is described by police as a career criminal -- is being held without bail after pleading not guilty to murder.

Gannon's Belgian malinois dog, Nero, also was shot but underwent surgery and is recovering.

The officer, who was posthumously promoted to sergeant, leaves behind a wife, parents, a brother and a sister.

The New Bedford native was a graduate of Bishop Stang High School in Dartmouth and Westfield State University. He had a master's degree from the Massachusetts Maritime Academy.

At his funeral Wednesday, a line of blue created by uniformed officers marched from the local high school to the church before the service started. It was made up by representatives from departments across Massachusetts and New England, from New York City and Chicago, and from as far away as Texas and California.

"We give him back to you without a murmur, but our hearts are wrung with sorrow," the Rev. Paul Caron said during a short service without a eulogy.

"So now we come together and mourn his death, but we also give thanks that he lived, that we knew him on some level," Caron said.

The Associated Press contributed to this report.