MIAMI BEACH, Fla. -

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.

[VIDEO: Bieber in court | READ: Arrest report (Warning, content may be graphic) | PHOTOS: Justin Bieber | On, off stage | Bieber fever gone wrong]

Bieber smiled in his mug shot released about 11 a.m., several hours after two black Cadillac Escalades blocked access to northbound Pine Tree Drive for a drag race -- Bieber, in a rented canary yellow Lamborghini, and his friend R&B singer Khalil Sharief, in a ruby red Ferrari.

Bieber, 19, made a brief appearance through a video link before a Miami judge, who set a "standard" $2,500 bond for his release Thursday afternoon.

The singer, dressed in an orange jail uniform, stood silently with his lips sometimes pursed as attorney Roy Black represented him in the hearing.

Black told Judge Joseph Farina that he had been retained by Bieber's manager. He said his partner had been denied access to Bieber in jail before the hearing.

About 4 a.m., officers spotted the 19-year-old speeding in the residential neighborhood. Bieber was going double the speed limit, and was defiant after police stopped him near Pine Tree Drive and 41st Street.

According to the arrest report, Bieber asks the officer "why did you stop me?" who said he smelled alcohol in Bieber's breath. Model Chantel Jeffries was in the passenger seat. The officer asked Bieber to step out of the car.

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

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

The officer tried to pat him down.

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

As the officer 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 Miami Beach police custody. Sgt. Bobby Hernandez said Bieber failed the field sobriety test.

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

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. 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.

About 2:41 a.m., Sharief posted a photo of Bieber in the passenger seat of a yellow Lamborghini, as a woman was driving up Washington Avenue. He also posted a photo of the driving wheel of the red Ferrari he was in.

Police are charging Bieber with driving under the influence, resisting arrest without violence and driving without a valid driver's license.  Both of the cars were impounded.

Last week, police searched his Calabasas, Calif., home in connection with a recent egg-throwing incident involving Bieber's neighbor. The neighbor's house suffered an estimated $20,000 in damage, which makes the alleged vandalism a felony.

He was cooperative with the dozen deputies, but he did not answer questions about the alleged vandalism, police said.

Deputies at the Lost Hills Sheriff's Station, which serves an affluent section of Los Angeles County just east of Malibu, have become familiar with Bieber since he moved into a $6.4 million home in The Oaks neighborhood two years ago.