Ultimately, he sealed his fate with his own bragging -- about drive-by shootings and other gang violence.

Nykees Earl Campbell wanted to rap about what was real. So he posted rantings in rap videos on YouTube and Facebook Live about his violent war with a rival gang, which played out with deadly consequences on the streets of Dallas.

It was exactly what prosecutors needed in their bid to give Campbell serious federal prison time. They say they matched up his words with actual crimes, including an ambush robbery in which he allegedly shot a man eight times while he was asleep in bed.

Campbell, 20, of Dallas hasn't been charged with those crimes, although he remains a suspect. But U.S. District Judge Barbara Lynn on Wednesday said the evidence prompted her to sentence Campbell, leader of the YNB Stretch Gang in South Dallas, to 12 years in federal prison.

The sentence stems from Campbell's guilty plea in February to a charge of distributing cocaine. Campbell, who has no criminal history, was initially facing almost six years in prison.

But Lynn granted Assistant U.S. Attorney Rick Calvert's request for an enhanced prison term due to Campbell's alleged violent gang activities - documented in his own videos that were played during Wednesday's sentencing hearing.

The case reflects a growing trend in which social media-savvy criminals have taken to Facebook, Twitter and Instagram to sing, rant and write about their misdeeds. Prosecutors in Dallas and nationwide have used such videos and postings as a road map to solving crime.

Lynn said she rarely grants requests for punishment above the sentencing guidelines, but told Campbell that much of the information she relied on "came out of your mouth." She said the evidence shows that he shot someone multiple times while he slept.

"You're bragging about shooting a person," Lynn said. "It's violence times 10 at every phase."

Nykees "NaNa" Campbell (Facebook)

Innocent bystanders, including a 6-year-old girl, were shot as gang members sprayed bullets indiscriminately in public, according to testimony Wednesday.

Another YNB victim, a rival gang member, was followed as he drove from his neighborhood and then attacked on U.S. 175 by another car, whose occupant sprayed bullets at him on a Sunday afternoon, Calvert said. He was shot in the neck but survived.

Lynn called such accounts "chilling" and said Campbell is a danger to the community.

"I'm not punishing you for making rap videos," Lynn said, adding that his rap lyrics provided her with some insight into his mindset.

Campbell, known as "NaNa" and "Ny-Nizzle," and his fellow YNB gang members remain suspects in several murders, Eric Barnes, a Dallas police homicide detective, said during testimony Wednesday.

When Campbell was arrested in November, the gang's violent activities in Dallas immediately stopped, Barnes said. Thirteen others with ties to YNB also were charged in the indictment with drug and gun offenses. Some have already been sentenced.

Campbell's attorney, Dianne Jones McVay, said the government tried to blame her client for crimes Dallas police have been unable to solve.

"My client is guilty of rapping," she said. "They can't prove their murders ... but they want to blame my client for all of them."

Note: This video contains profanity.

She said if the police can prove their case, they will file charges. "They haven't done that," McVay said.

Federal authorities in North Texas have focused their attention on violent street crime in response to a directive last year from Attorney General Jeff Sessions.

Last week, the U.S. attorney in Dallas announced the arrests of seven MS-13 gang members and associates, on charges that include racketeering, attempted murder and assault with a dangerous weapon.

Rap beef

YouTube rap videos, some professionally produced, started the war between the YNB and the Ben Frank Gang, known as BFG, said Calvert.

Barnes said in testimony that it began when a BFG member threatened in a video to kidnap Campbell's young daughter, who is now 3.

Campbell, a prolific social media poster, responded with threats and escalated violence between the gangs with his rap videos glorifying gang culture and criminality, Barnes said.

"He's adamant that he raps about stuff he lives," Barnes said.

Rival gangs weren't the only target, he said. Campbell and his gang threatened singer Chris Brown over some "beef" with the artist and warned him not to come to Dallas, Barnes said.

Calvert, who sought a 15-year sentence for Campbell, said the defendant encouraged a "ridiculous amount of violence" across the city with his "flagrant" videos, including a number of shootings. In one song, Campbell rapped about shooting a man while robbing him of drugs and jewelry, Barnes said. Barnes said police believe he shot that man eight times in June 2016.

Nykees Campbell and YNB Stretch Gang (Facebook)

Dallas police zeroed in on YNB in early 2016, particularly after a double murder that year in Pleasant Grove.

Damontre Sweeney, the 18-year-old leader of BFG, and another member, Jabri Jones, were shot to death inside a car during an ambush. No arrests have been made.

But Barnes said Quinton Hodge, a 19-year-old YNB member who's headed to state prison for 40 years for shooting someone during a robbery, is suspected of killing the men.

Hodge's attorney could not be reached for comment.

After the murders, YNB produced a video at the same location of the ambush, with lyrics referencing the slayings, the detective said.

The gang continued its provocations, posting a photo of a YNB member standing in front of Sweeney's house at night, with a caption saying they turned his house into a "haunted house."

Another YNB member, Kris Greene, is suspected of shooting the 6-year-old girl during a 2016 drive-by attack, the detective said in his testimony.

Greene, 20, also is charged in the federal drug indictment. His attorney could not be reached for comment.

Not gonna change

Dallas police in 2016 became overwhelmed with calls about robberies, drive-by shootings and other YNB-related violence that spilled over across the Dallas area on a weekly basis, Barnes said.

"This organization was out of control," he said.

Barnes said his department reached out to federal authorities for help. At one point, the Dallas police gang unit arrested Campbell and Barnes asked him to stop writing the social media posts that were fueling the gang war, Barnes said.

But once he was released, Campbell immediately continued his "taunting" Facebook posts, Barnes said.

Barnes said YNB members were getting booked at various music venues to perform, including South by Southwest in Austin. Barnes said he called organizers to warn them about the gang, and their performances were canceled.

Nykees Campbell and his social media accounts (Facebook)

Campbell didn't change even after his arrest on federal charges, Barnes said. An Instagram post shows a smiling Campbell posing in his jail jumpsuit with a caption threatening "snitches" and saying he wouldn't change for $100 million or 100 years.

And in a jail interview that was posted on YouTube in January 2017, Campbell complains about his co-defendants snitching on him and tells the interviewer, "I wouldn't take nothing back."

One of his lessons: If you're rapping while "beefing," it better be fake. Because if it's real, you'll be behind bars like him.

When he stood Wednesday in front of Lynn, the federal judge, Campbell took a different tone, saying he was sorry for his mistakes and wants to be "a better man."

"I was really just caught up in that," he said about his videos. "I'm not saying it's right."