NEW YORK — A gunman who killed four people at a Manhattan office building before killing himself claimed in a note to have a brain disease linked to contact sports and was trying to target the National Football League’s headquarters but took the wrong elevator, officials said Tuesday.

Investigators believe Shane Tamura, of Las Vegas, was trying to get up to the NFL offices after shooting several people in the lobby on Monday, but that he entered the wrong elevator banks, Mayor Eric Adams said in interviews.

Four people were killed, including an off-duty New York City police officer, Didarul Islam.

Tamura, who played high school football in California nearly two decades ago but never in the NFL, had a history of mental illness, police said. A three-page note found in his wallet suggested he had a grievance against the NFL over a claim that he suffered from chronic traumatic encephalopathy. The degenerative brain disease has been linked to concussions and other repeated head trauma common in contact sports such as football, but it can only be diagnosed after someone has died.

In the note, Tamura repeatedly said he was sorry and asked that his brain be studied for CTE, according to the police department. The note also referenced former NFL player Terry Long, who was diagnosed with CTE, and the manner in which Long killed himself in 2005. The note accused the NFL of concealing the dangers to players’ brains for profit.

NFL Commissioner Roger Goodell called the shooting ‘’an unspeakable act of violence in our building,’’ saying he was deeply grateful to the law enforcement officers who responded and the officer who gave his life to protect others.

Goodell said in a memo to staff that a league employee was seriously injured in the attack and was hospitalized in stable condition.

The shooting happened along Park Avenue, one the nation’s most recognized streets, and just blocks from Grand Central Terminal and Rockefeller Center. It’s also less than a 15-minute walk from where UnitedHealthcare CEO Brian Thompson was shot and killed last December by a man who prosecutors say was angry over corporate greed.