A Brooklyn man accused of murdering a 66-year-old professor after a war of words over immigration is claiming self-defense, his attorney said Friday.

Through attorney Jay Schwitzman, Mirzo Atadzhanov, 28, of Brooklyn, entered a plea of not guilty for murder and burglary charges in the May 7 death of Jeremy Safran, a professor of psychology at The New School for Social Research as well as New York University’s Postdoctoral Program in Psychotherapy & Psychoanalysis.

According to court papers, Safran hired Atadzhanov to “work on his lights” in his home, even though Atadzhanov said he wasn’t an electrician.

The New York Daily News reported that Safran, a Canadian, wasn’t satisfied with Atadzhanov’s work, complaining: “This country cannot benefit from immigrants.”

Atadzhanov, who claimed to be from Tajikistan, said he was offended, and their fight escalated.

Atadzhanov said Safran tried to stab him with a combat knife, and he “followed his instincts,” according to court documents.

Prosecutors, however, claim that Safran was working out when Atadzhanov broke into his home and attacked him.

The Daily News reported that a neighbor saw Atadzhanov going in and out of the house, and called Safran’s wife to warn her.

Police had gone to the home to investigate a report of a burglary in progress when they found Safran in the basement with trauma to his head and body.

In his statement to police, Atadzhanov said that “the wife came down the stairs with a pit bull,” and scared him into a closet in the basement, where cops found him hiding inside with several tools, including a hammer.

“He is mourned and loved by hundreds of young students and by colleagues who he has touched around the world,” said Dr. Lewis Aron, Director at NYU’s Postdoctoral Program in Psychotherapy & Psychoanalysis about Safran last month. “It is mind numbing to me that this brilliant but so gentle and kind man met such a brutal and violent end.”

The Associated Press contributed to this report.