A 28-year-old man was shot inside a building on Gates Avenue near Tompkins Avenue Wednesday afternoon before the shooter turned the gun on himself during a standoff with the NYPD, police said. View Full Caption Danny Potts

BED-STUY — A man suspected of shooting another man in a Gates Avenue building during a "landlord dispute" turned the gun on himself after being barricaded inside an apartment for several hours Wednesday afternoon, police said.

Officers responded to the scene to find a 28-year-old man shot twice on the third floor of 565 Gates Ave. near Tompkins Avenue at about 1:58 p.m., an NYPD spokeswoman said.

The suspected shooter, a 32-year-old man, barricaded himself on the fourth floor but was later found with a self-inflicted gunshot wound to the head, police said.

"We tried to make contact and identify his location inside. Eventually we came upon him in the rear bedroom with a self-inflicted gunshot wound to the head and two firearms," ESU Deputy Chief Vincent Giordano said at the scene. "We administered first aid immediately and got him down to EMS who took over outside."

The 32-year-old was taken to Kings County Hospital in critical condition, while the 28-year-old was taken to the same hospital with non-life-threatening injuries, authorities said.

It was not immediately clear if the victim or shooter was the landlord of the building.