The family of a Bronx teenager who was fatally shot by a police officer who had barged into his apartment after suspecting him of taking part in a drug deal has agreed to settle a wrongful-death lawsuit against the city for $3.9 million.

The agreement to settle the case, reported Friday by The Daily News, comes nearly three years after the Feb. 2, 2012, shooting of the teenager, Ramarley Graham.

“This was a tragic case,” said Nicholas Paolucci, a spokesman for New York City’s Law Department. “After evaluating all the facts, and consulting with key stakeholders such as the N.Y.P.D., it was determined that settling the matter was in the best interest of the city.”

Mr. Graham’s family did not comment on Friday. Their lawyer, Royce Russell, said that relatives would hold a news conference on Monday and release details then about a memorial service. Stuart London, a lawyer for Richard Haste, the police officer who shot Mr. Graham, did not return emails and phone calls seeking comment on Friday evening.