A Maine fire chief died Sunday after suffering a medical episode while attending the funeral of a firefighter who was killed battling a blaze earlier this month, the state's governor said.

The Portland Fire Department told Fox 23 it responded to a parking garage outside the downtown Cross Insurance Arena approximately one hour before the scheduled start of the funeral service for Berwick Fire Capt. Joel Barnes. Oxford Fire Chief Gary Sacco was pronounced dead at Maine Medical Center. Further details were not immediately available.

Sacco was named Oxford fire chief in June 2017. He previously retired as chief in nearby New Gloucester in 2015 after 12 years in that job.

"Our hearts, already broken by the loss of Captain Joel Barnes, also mourn the loss of Oxford Fire Chief Gary Sacco. In a testament to his own character, Chief Sacco lost his life while honoring that of his fallen brother, fellow firefighter Captain Barnes," Maine Gov. Janet Mills said in a statement. "I join with people across Maine in offering my thoughts and prayers to Chief Sacco's family and friends, the Oxford Fire Department, and all of Maine's first responders. The State of Maine has given two of its best to the Heavens."

CALIFORNIA BOY, 2, HELPS FIREFIGHTER RESPONDING TO CALL, VIDEO SHOWS

Barnes, 32, was injured and later died after he shielded a colleague from a March 1 four-alarm fire at an apartment building in Berwick. He and another firefighter encountered a wall of flames on the third floor and had to be rescued. Five firefighters were injured that day, and Barnes died at a hospital in New Hampshire.

Berwick Fire Chief Dennis Plante said Barnes had made "the ultimate sacrifice" and called him "my hero."

Barnes became the first Maine firefighter to die while battling a fire in nearly 40 years. Stephen McCausland of the Maine Department of Public Safety told The Associated Press that the last time it happened was in 1980 when Portland Firefighter Joseph Cavallaro Jr. died of burns and asphyxiation while fighting a three-alarm fire at the Phoenix Nightclub.

The day started with a private Mass for Barnes in Old Orchard, where he grew up. Then a procession escorted Barnes' body up I-95 to South Portland, where the casket was placed in a fire truck.

From there, the procession headed across the Casco Bay Bridge where fire boats saluted Barnes en route to the arena, one of the few venues in the state large enough to host such a gathering.

Barnes' uncle, also named Joel, grew teary as he described a nephew who grew up dedicated to serving the community as a firefighter. He recalled how an elderly neighbor once gave a plastic firefighter hat to then-toddler Joel, who soon became "obsessed" with studying fire science books and preparing himself for a career that took him from Maine, to Massachusetts, to South Carolina and back to his family in Maine.

CLICK HERE TO GET THE FOX NEWS APP

"Without hesitation, he gave his life to save the life of another firefighter," Barnes said. "And he did it in the most selfless, courageous way possible."

Mills lowered flags to half-staff to honor Barnes. She said his life and service exemplified "unfaltering courage, selflessness and love for his fellow man."

The Associated Press contributed to this report.