A firefighter died Thursday while battling a two-alarm fire in Ridgewood.

The FDNY and Mayor Bill de Blasio identified the firefighter as William Tolley, a 14-year veteran of the department with Ladder 135 and Engine 286.

Officials said the fire broke out on the second floor of a five-story apartment building located at 1615 Putnam Avenue in Ridgewood around 2:20 p.m. Thursday

Fire Commmissioner Daniel Nigro said Tolley died after falling five stories from the roof about 20 minutes into fighting the fire.

Witnesses said Tolley was about to step into the bucket attached to the ladder when it suddenly jerked back.

"I saw the ladder to the building, and then suddenly I heard a voice boom and a person was falling from the roof," one witness said.

Nigro said the circumstances of the fire and the fall are under investigation.

Three civilians were also transported to Wyckoff Hospital with minor injuries.

A memorial for Tolley was set up outside his stationhouse in Glendale.

Nigro said Tolley is the 1,147th member of the FDNY to die in the line of duty.

He was 42 years old. Tolley leaves behind a wife and an 8-year-old daughter.