Jahseh Onfroy, the rapper and singer known as XXXTentacion, whose surge in popularity in the last year and a half — including a No. 1 album — came as he was facing accusations of violent crimes against a woman, was shot and killed outside a motor sports store in Deerfield Beach, Fla., on Monday afternoon. He was 20.

The Broward Sheriff’s Office confirmed the victim was Mr. Onfroy. Videos taken at the scene on Monday and shared on social media showed the rapper’s slumped body in the driver’s seat of a black BMW sports car as a bystander attempted to take his pulse. TMZ first reported the news of the shooting.

Mr. Onfroy had been approached by two armed suspects shortly before 4 p.m., in what appeared to be a robbery, the sheriff’s office said. At least one of the suspects fired a gun and struck the rapper before fleeing in a dark-colored S.U.V. Mr. Onfroy was transported to a local hospital. Just after 5:30 p.m., the authorities said that he had been pronounced dead.

[A suspect has been arrested in the killing of XXXTentacion: read more here.]

In the last 18 months, XXXTentacion quickly became one of popular music’s most controversial and, in some circles, reviled figures. In early 2017, “Look at Me!” — a bratty, caustic, distorted song — became the first breakthrough hit of the SoundCloud rap movement. But at the time it was soaring in popularity, XXXTentacion was in jail following his arrest on charges including aggravated battery of a pregnant victim and false imprisonment. By the time he was released from jail in March of last year, “Look at Me!” was climbing the Billboard Hot 100; a month later, it would peak at No. 34, cementing the rapper’s place as a disrupter whose serious personal issues only led to more attention and, for some, shored up his outlaw mystique.