Watch "Justin Bieber's Wild Ride" on CNN at 10 p.m. ET on Friday.
(CNN) -- Justin Bieber was charged with drunken driving, resisting arrest and driving without a valid license after police saw the pop star street racing early Thursday morning, Miami Beach police said.
"What the f*** did I do? Why did you stop me?" Bieber asked the police officer who pulled him over just after 4 a.m., according to the arrest report.
Bieber, 19, was released from a Miami jail an hour after he made a brief appearance through a video link before a Miami judge, who set a "standard" $2,500 bond Thursday afternoon.
He strutted out of the jail dressed in black, with a baggy hoodie covering his head. His pants appeared to be baggy leather. Bieber briefly sat on top of a black Cadillac Escalade, where he waved to screaming fans, before he was chauffeured away.
At the bail hearing, the singer, dressed in an orange jail uniform, stood silently with his lips sometimes pursed as attorney Roy Black represented him in the hearing earlier.
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.
Bieber was booked into a Miami jail after failing a sobriety test, Miami Beach Police Chief Raymond Martinez told reporters Thursday.
Bieber "made some statements that he had consumed some alcohol, and that he had been smoking marijuana and consumed some prescription medication," Martinez said.
A Miami Beach officer saw Bieber driving a yellow Lamborghini in a race against a red Ferrari in a residential area of Miami Beach, Martinez said. The cars were speeding at about 55 to 60 mph in a 30 mph zone, he said.
The officer pulled Bieber's car over, but the singer was "was not cooperating with the officer's instructions," Martinez said.
"At first, he was a little belligerent, using some choice words questioning why he was being stopped and why the officer was even questioning him," he said.
He allegedly ignored a police officer's request to keep his hands on the car while he did "a cursory patdown for weapons," the report said.
"I ain't got no f***ing weapons," the arresting officer quoted Bieber as saying. "Why do you have to search me? What the f*** is this about?"
The arrest report describes Bieber as having a "flushed face, bloodshot eyes, and the odor of alcohol on his breath."
Bieber failed a field sobriety test, Miami Beach Police Sgt. Bobby Hernandez told CNN.
Two black SUVs blocked the traffic at 26th and Pine Tree Drive, which "facilitated an open road" for the two cars to race on Pine Tree, the report said.
The Ferrari's driver, identified as 19-year-old Def Jam recording artist Khalil Sharieff, was also arrested on a drunken driving charge, police said.
Sharieff posted a photo on his Instagram account of Bieber in the yellow Lamborghini with a woman behind the wheel early Thursday. "U know bizzle brought that lambo out," he wrote in the caption.
Another posting showed a photo of a Ferrari steering wheel with the caption: "Miami nights ridin thru yo city in that hot wheel."
A tweet posted Wednesday evening on Sharieff's verfied Twitter account linked to a video of him playing basketball with Bieber.
Bieber flew to Miami on Monday.
Another police department in the Miami area is investigating a report that some of its officers escorted Bieber's caravan between Miami strip clubs this week without authorization.
Opa-Locka Assistant City Manager David Chiverton told CNN affiliate WSVN-TV that "at some point, the escort took them at least to two locations that we know of."
"The police administration had no knowledge of this escort, and it is not the norm for those things to occur without the chief and his administration authorizing such escorts," Chiverton told the TV station.
Thursday's incident marks the first time the teen singer has been arrested, although he is under investigation on allegations of egging his California neighbor's home.
Los Angeles County sheriff's deputies used a felony search warrant last week to raid Bieber's mansion in the felony vandalism investigation. They seized Bieber's iPhone and the security camera system, which detectives have been examining for clues about who tossed eggs over a fence that splattered onto the next-door house, causing an estimated $20,000 in damage.
Deputies have also investigated reports by Bieber's neighbors that he raced his expensive sports car down the streets of the exclusive Oaks community of Calabasas, California, but no charges ever resulted.
One neighbor accused Bieber of spitting in his face during a heated confrontation last March. Deputies have responded to complaints about loud parties at Bieber's place.
The Los Angeles County district attorney's office concluded it couldn't prove the spitting or speeding cases in court, so it declined to prosecute.
Prosecutors also rejected a misdemeanor battery complaint from a photographer who accused Bieber of attacking him in the parking lot of a Calabasas shopping center as he was taking photos of Bieber and his then-girlfriend, Selena Gomez, in May 2012.
"We didn't do this search warrant to send a message," Sheriff's Lt. David Thompson said last week. "That's not what we do, but we hope maybe that understanding the gravity of this will change some of the behavior."
CNN en Español's Adriana Hauser contributed to this report.