A Brooklyn apartment building super died after being bashed in the head with a cell phone during a clash with a package thief Wednesday morning, according to cops and relatives.

The 41-year-old super, who was identified by family members as Burim Havolli, got into a heated dispute with his attacker around 8:12 a.m. inside a building on Ocean Ave. and Glenwood Road in Midwood, and was repeatedly bashed over the head with a cellphone device, police sources said.

“He was beating him in the head,” a cousin of the victim, who did not want to be named, told the Daily News.

Havolli subdued his attacker who was allegedly trying to steal packages from the building, until police arrived and took the man into custody, according to the building’s porter, Johnny Garcia, 55, who said he worked with Havolli for 15 years.

“He came to grab the packages. Benny tried to hold him until the police come,” Garcia told The News. “It started in the lobby and they fight. It ended up outside the building.”

Following the clash, Havolli went up to his second floor apartment and went to take a shower, but began to vomit and then collapsed, the victim’s cousin said.

Police rushed to the scene, finding the victim with injuries to his head — and that he had suffered an apparent heart attack shortly afterward, cops and sources said. EMS transported the super to Kings County Hospital in critical condition, where he later died.

“He was a good man — no, he was a great man,” another relative ,who did not want to be named, told The News. “He leaves his wife and three little babies. It’s terrible.”

A person was taken into custody but no charges were immediately filed, sources said.

Police also retrieved a scooter and a black hoodie that belonged to the suspect.

The Medical Examiner will determine the exact cause of death, and if the incident was a homicide.

“His name was Berim but we called him Benny,” Garcia said. “He was a good person and a hardworking guy. He was the greatest guy — that’s why I stayed with him for 15 years.”

The porter said the building has had problems for the past year with people stealing packages from the building.

“It’s three guys that come to steal the packages,” Garcia said. “It started last year. By the summer time, it was two or three times a week.”

A sign alerting residents to package thieves was plastered throughout the building, noting thieves usually come late at night and try to gain access to the building by ringing door bells of every resident, claiming they lost their keys.