PEABODY - The streets were eerily quiet, the sidewalks thick with rows of men in dark dress uniforms, as this city paused yesterday to pay respect to a man they called a hero.

When a fire engine draped in black and purple bunting passed through Peabody Square bearing the casket of Firefighter James M. Rice, hundreds of white-gloved hands snapped in salute. A huge American flag rippled overhead, hung between two extended fire engine ladders.

“Every time I look at that flag I cry,’’ said one of the hundreds of Peabody residents who turned out to watch the procession, Cheri Rathbun, whose son is friends with one of Rice’s children. “In my 39 years here, I have never felt anything like I do today.’’

Rice, 42, a father of three young children, died in a fire two days before Christmas.

His funeral marked the second time in two weeks that firefighters from across the region flocked to a final salute for a colleague. Jon D. Davies Sr., 43, a 17-year veteran of the Worcester Fire Department, died Dec. 8 in the collapse of a burning three-decker; his funeral was Dec. 15.

Rice was killed Dec. 23 while battling a three-alarm blaze in an apartment building. About a dozen people escaped the afternoon fire on Hancock Street, but he became trapped in the structure before crews found him and carried him out.

More than 700 mourners bade Rice farewell yesterday in a towering brick church around the corner from the Peabody fire station. Near the end of the funeral service, Deputy Fire Chief Joseph Daly struck a gleaming bell 15 times, the sharp clangs reverberating in the sanctuary to symbolize the end of the fallen firefighter’s duties.

In the streets of Peabody yesterday, among the throngs of out-of-town firefighters who congregated in pubs and on street corners and the crowds of residents who solemnly watched the procession, many expressed the same wish, that the show of gratitude and admiration would bring some comfort to a stricken family.

Speaking during the funeral, Rice’s father, Brian MacKenna-Rice, made clear that it did.

“I recognize now that this heartfelt outpouring of support is not because Jim died, but because he lived,’’ he said near the end of his eulogy, his voice trembling. “I will be proud of the memory of the manner in which he lived . . . his compassion, good deeds, and unconditional love.’’

The Greek Orthodox funeral was held at St. John the Baptist Catholic Church because the family’s church, St. Vasilios, is being renovated. At the front of the packed sanctuary, before an altar flanked by red and white poinsettias and Christmas trees decked with tiny white lights, the casket lay beneath a purple cloth, with Rice’s firefighting helmet placed on top of it.

His children, Alyssa, 12; Katelyn, 9; and Ryan, 7, sat beside their mother in the front pew, a few feet away.

The Rev. Christopher P. Foustoukos, pastor of St. Vasilios Church, addressed the three children directly, describing their father as a blooming orchid picked by God and comparing the good-natured man to a teddy bear. He then produced three teddy bears dressed as firefighters and gave them to the children, who sat quietly in a row.

“My hope is that this brings you some comfort in the days ahead,’’ he told them. “There will be days that will be difficult.’’

Speakers at the funeral described Rice’s selflessness, loyalty, and humor. A 1987 graduate of St. John’s Preparatory School, where he played football and baseball, and Bentley College, where he studied marketing, Rice worked in banking before deciding to become a firefighter. He joined the Peabody department 11 years ago.

Peabody Fire Chief Steve Pasdon spoke forcefully to mourners about the danger of firefighting and dismissed the idea that the risk has declined with new equipment.

“It has in one way increased our safety and enabled us to save lives,’’ said the chief. “At the same time, it has equipped us to get further into the most hostile environment known to man, endangering the lives of firefighters more than ever before.’’

Pasdon offered comfort to the men who served with Rice the day he died.

“Please know that all of you . . . did all you could,’’ he said.

Firefighters traveled to Peabody yesterday from as far away as Calgary and from Toronto and New York. They came from Massachusetts cities - Worcester sent more than 100 - and from its small towns: Goshen, Hatfield, Mattapoisett. Only a fraction of them fit into the church, so most waited outside through the service, sharing war stories.

Dave Acker - a 27-year firefighter, most recently with the East Haven, Conn., Fire Department - was among those waiting in Brodie’s, a downtown pub.

“This is our culture,’’ he said. “You don’t have to know the guy to know the guy.’’

“In a generation that has become known as the ‘Me Generation,’ when many think only of themselves . . . I thank God Almighty for men and women like Jim Rice,’’ he said.

In a message printed on the back of the funeral program - under a photo of Rice grinning and wearing a Red Sox T-shirt - his wife, Amy, offered thanks.

“It is amazing for us to see how many lives Jim has touched and how everyone remembers his sense of humor and his smile,’’ she wrote. “This is how we hope you will remember him.’’

John R. Ellement of the Globe staff and Globe correspondent Amanda Cedrone contributed to this report. Jenna Russell can be reached at jrussell@globe.com. John M. Guilfoil can be reached at jguilfoil@globe.com. Follow him on Twitter @globe_guilfoil. Justin Rice can be reached at jrice.globe@gmail.com.