To his family, Michael J. Fahy was a hero long before he was taken from them.

It took a house explosion in the Bronx for the rest of New York City to learn what the FDNY battalion chief’s wife and three children already knew.

“My dad was a fair, kind and honest man, and a wonderful dad. He was also a great athlete, cook, musician — and very brave. He was a perfect dad,” 8-year-old Anna told mourners Saturday at her father’s funeral.

“Dad, you are the greatest. I could always count on you to be there when I needed you. You were always there on the sidelines for every game, cheering me on. I know you are proud of me, and I am so proud of you. Dad, you’re my hero,” said Fahy’s oldest son, Michael, 11.

Nearly 10,000 gathered at a Yonkers church to honor Fahy, 44, in a farewell filled with all the pageantry bestowed upon first responders who die in the line of duty: “Taps” and bagpipers. Honor guard and helicopter flyover. And a white-gloved salute by thousands of firefighters from across the country.

The massive funeral procession stretched nearly a mile from Annunciation Church.

advertisement | advertise on newsday

Mayor Bill de Blasio, eulogizing Fahy on behalf of the city he served since 1999, told how Fahy gave up the practice of law to follow in his father’s footsteps.

De Blasio read a letter Fahy had written explaining the switch.

“While I enjoyed the study of law I feel that I need a career with a higher, more honorable purpose. I would like to be a New York City firefighter,” the letter said.

Addressing Fahy’s children, de Blasio referenced his own father, an emotionally scarred Army veteran who committed suicide.

“Just like you I lost my dad when I was young. . . . But I knew that my father was a hero,” the mayor said. “When you’re grown up, decades from now, good times and bad, you will be able to rely on that knowledge that not only was your father a good man, he was a hero.”

FDNY Commissioner Daniel Nigro said Fahy “put himself in harm’s way so others would be protected, and they were.”

Nigro posthumously promoted Fahy from battalion chief to deputy chief, the test for which he had already passed several years ago and was awaiting promotion. His father, Thomas Fahy, is a retired FDNY battalion chief.

FDNY Capt. Brendan J. Deehan, who also eulogized Fahy, recalled how he had often sought his advice. “Anytime there were a few ways to do something, I would think, ‘What would Fahy do?’ ”

All four citywide elected officials and Cardinal Timothy Dolan, the archbishop of New York, attended the funeral, as did Darcel Clark, the Bronx district attorney, whose office is prosecuting two men arrested in connection with the explosion.

Firefighters arrive for the funeral of FDNY Deputy Chief Michael J. Fahy on Saturday, Oct. 1, 2016, in Yonkers. Fahy died Sept. 27. Photo Credit: FDNY

Early Tuesday, firefighters responded to the building in the Kingsbridge section to investigate an odor of gas. While supervising the scene, Fahy was fatally struck by debris when the blast blew the roof off the building.

advertisement | advertise on newsday

The explosion may been sparked by a gas main that had been tampered with. The NYPD is working to determine the exact cause. The building is suspected of housing a marijuana growing operation.

Born in the Bronx, Fahy lived with his family in Tuckahoe in Westchester.

Fahy became a firefighter in August 1999 with Engine Company 35 in Harlem. He was the 1,145th firefighter to die in the line of duty since 1865, when the FDNY was founded.

During the funeral service, Fiona Brett-Fahy called her husband “an extraordinary human being” who filled her life with love.

Firefighters arrive for the funeral of FDNY Deputy Chief Michael J. Fahy on Saturday, Oct. 1, 2016, in Yonkers. Fahy died Sept. 27. Photo Credit: Craig Ruttle

“The last remnants of the flowers he bought me for no reason last week still sit on the kitchen counter,” she said through tears.

advertisement | advertise on newsday

Fahy was buried at Gate of Heaven Cemetery in Hawthorne in Westchester County.