THEY GAVE ALL: William Spengler Jr. set this house fire yesterday in Webster, NY, to bring firefighters to the scene, and then killed two of them when they arrived to battle the blaze: “Firefighter of the Year” Michael Chiapperini and Tomasz Kaczowka. Photo: AP

WILLIAM SPENGLER JR. Kills self after rampage.

(
)

A madman yesterday set his home ablaze to lure volunteer firefighters to the scene — then methodically shot four of them, killing two, before blowing his brains out, authorities said.

The horrific attack in the tight-knit, upstate town of Webster, just outside Rochester, was carried out by ex-con William Spengler Jr., a loser mama’s boy who once spent 17 years in prison for beating his grandmother to death.

Cops were exploring connections Spengler and his late mom, Arline, had to the West Webster Fire Department, officials said.

Spengler, 62, first torched his family’s home on Lake Road, where Irondequoit Bay meets Lake Ontario, at around 5:45 a.m. — then lay in wait for his unsuspecting prey.

Crouched like a sniper and armed with a rifle and a handgun, Spengler targeted responding firefighters from behind an earthen berm that gave him a clear shot, said Webster Police Chief Gerald Pickering.

“He took a position of cover to be a sniper to shoot the first responders . . . It does appear it was a trap that was set,’’ a grim-faced Pickering said.

It’s unclear why Spengler targeted the men, although he was having personal problems.

He lived with a sister he hated, neighbors said, in the same house where he had fatally bludgeoned his 92-year-old grandmother with a hammer in 1980.

The sister, Cheryl, 67, is missing, and cops, fearing the worst, will search the house for her remains.

Spengler’s beloved mother, Arline died in October. In her obituary, donations were directed to the “West Webster Firemen’s Association (Ambulance Fund).’’ It wasn’t immediately clear why.

“We are aware of it and trying to figure out the connection,” said a source with the sheriff’s office.

One of Spengler’s victims yesterday, 43-year-old Michael Chiapperini, was a volunteer with the West Webster Fire District and a lieutenant in the town’s police department, where he also served as a media liaison.

The selfless Chiapperini, who spent 20 years as cop, had spent time in Suffolk County last month, volunteering for Hurricane Sandy cleanup duty, officials said.

He had just been named a local “Firefighter of the Year.”

He is survived by his wife, two daughters and a son who also worked with the volunteer fire department.

The other man killed was volunteer Tomasz Kaczowka, a 19-year-old 911 dispatcher and a community-college student with dreams of becoming a full-time firefighter.

“These people get up in the middle of the night to fight fires,” said Chief Pickering, choking back tears. “They don’t expect to be shot and killed.”

Two more volunteer firefighters, Joseph Hofstetter and Theodore Scardino, were wounded by bullets. A cop suffered injuries from shrapnel. All three were expected to survive.

Hofstetter, who also works full time for the Rochester Fire Department, was hit in the pelvis and the bullet lodged in his spine. Scardino was hit in the chest and knee.

The firefighters had to fall back after shots were first fired, allowing flames from Spengler’s home to spread to neighboring houses.

Spengler then traded shots with officers who arrived with an armored truck they used to remove the injured, as well as people living nearby.

He was chased on foot from his perch, then killed himself before he could be subdued, cops said.

Four houses burned to the ground and four more were damaged by the time the blaze was brought under control.

Dozens of people had to be evacuated from the smoldering area on Christmas Eve.

During the gunfight, emergency radio communications captured someone frantically saying he “could see the muzzle flash coming at [him],” as Spengler fired.

The audio, posted on the Web site RadioReference.com, also had someone reporting, “Firefighters are down!” and saying, “Got to be rifle or shotgun — high-powered . . . semi or fully auto.”

It would have been illegal for Spengler, as a convicted felon, to possess any firearm at all.

Sheriff Patrick O’Flynn said he couldn’t help thinking about the school massacre in Newtown, Conn., and other mass shootings in recent years.

“It’s sad to see this is becoming more commonplace . . . across the nation,” O’Flynn said.

At West Webster Fire Station 1, there were 20 bouquets on a bench in front. Another bouquet had roses with three gold-and-white ribbons saying, “May they rest in peace,” “In the line of duty,” and, “In memory of our fallen brothers.”

Gov. Cuomo asked New Yorkers to pray for the firefighters’ families, victimized by this “senseless act of violence.”

Last December, a 15-year-old boy doused his home in Webster with gasoline and set it ablaze, killing his father and two brothers, ages 12 and 16.