Pop star Justin Bieber said he smoked marijuana, drank alcohol and took prescription drugs before officers caught him drag racing in Miami Beach early Thursday morning, police said.

About 2 p.m., Bieber walked out of jail smiling, jumped on top of a black Cadillac Escalade, smiled and waved at fans and media. He also smiled on his mug shot, before high-profile defense attorney Roy Black showed up to represent him at bond court.

Bieber waves as he leaves jail

Miami-Dade County Judge Joseph Farnahis set his bond at $2,500 on three counts -- driving without a valid license, driving under the influence and resisting arrest without violence.

"He had consumed some alcohol and he had been smoking marijuana," Miami Beach Police Chief Raymond Martinez said. "He had consumed some pharmaceutical drugs."

Bieber's troubles in Miami-Dade began about 4 a.m., when four black Cadillac Escalades blocked access to northbound Pine Tree Drive at 26 Street, so that he could play.

FULL COVERAGE: Justin Bieber busted

Bieber and his entourage turned Pine Tree Drive into a drag race -- Bieber and a teenage model were in a canary yellow 2013 Lamborghini, and his friend R&B singer Khalil Sharief, in a ruby red 2009 Ferrari -- police said.

WATCH: Justin Bieber's alleged drag race caught on video

Officers in the area spotted the 19-year-old Canadian speeding in the residential neighborhood. An officer in the area estimated he was going double the speed limit.

Bieber was defiant after police stopped him near Pine Tree Drive and 41st Street. During the arrest, he cursed several times, according to the police arrest report.

READ: Justin Bieber Arrest Report (Warning: Graphic language)

"Why did you stop me?" Bieber asked officer Fulgencio Medina, who said he smelled alcohol in Bieber's breath. Model Chantel Jeffries was in the passenger seat.

Medina asked Bieber to step out of the car.

"Why the f---- are you doing this?" Bieber asked Medina, as he kept his hands in his pockets.

"What the f-- did I do? Why did you stop me?"

Medina tried to pat him down. Bieber was belligerent.

"I ain't got no f--- weapons. Why do you have to search me? What the f--- is this about?"

As Medina grabbed Bieber's right hand to handcuff him, Bieber began to resist arrest, police said.

"What the f--- are you doing?" Two officers placed him into custody.

Police said Sharieff's car had an "odor of marijuana coming from the passenger" side.

Sgt. Bobby Hernandez said Bieber failed the field sobriety test with a blood-alcohol-content of .04 percent. Under Florida law, drivers under 21-years-old are under the influence with a blood-alcohol-content of .02 percent.

Officers also discovered Bieber's Georgia driver's license had expired six months ago, police said.

On his way to the Miami Beach police department Bieber told an officer that he was coming back from recording music at a studio, the arrest report said. But fans on social media placed Bieber partying at SET Nightclub, 320 Lincoln Road, in South Beach.

About 10 a.m., Miami-Dade corrections officers took Bieber from Miami Beach Police Department to Turner Guilford Knight Correctional Center, 7000 NW 41st Street.