Pop star Justin Bieber is facing the threat of a prison sentence after officers saw him drag-racing before dawn in a residential street in Florida, his yellow Lamborghini travelling at nearly twice the speed limit.
The 19-year-old singer later admitted smoking marijuana, drinking and taking a prescription medication, police say.
He was charged with driving under the influence, driving with an expired licence and resisting arrest without violence.
His Miami-Dade County jail mug shot showed the singer smiling in a bright red inmate jumpsuit, his hair still stylishly coiffed.
He was arrested with R&B singer Khalil Amir Sharieff, after police saw them racing two cars down the street at 4.09am local time, with two other vehicles apparently being used to block off the area.
Police chief Ray Martinez said the singer was initially not co-operative when the officer pulled him over. He said the singer also had an expired Georgia driver's licence.
Police said Bieber was driving the Lamborghini and Sharieff was driving a Ferrari. Both cars were towed away. Police say Bieber was clocked at 55 mph to 60 mph in a 30 mph zone near a school and youth centre.
According to the arrest report, Bieber "had slow deliberate movements" and appeared to be in a stupor when the officer ordered him to exit his vehicle.
Bieber was arrested after repeatedly refusing to put his hands on his vehicle so the officer could pat him down to look for weapons, the report said.
It says he swore several times at the officer and demanded to know why he was being arrested. At one point, Bieber said to an officer: "What the f--- did I do, why did you stop me?"
Bieber failed a field sobriety test and was taken to the Miami Beach police station to be breathalysed, police said. Results have not been released.
"I think this case will proceed hopefully as any other case would proceed," said Bieber's lawyer Roy Black, whose other celebrity clients have included Rush Limbaugh and William Kennedy Smith.
Under Florida law, people under the age of 21 are considered driving under the influence if they have a blood-alcohol content of 0.02% or more - a level the 5ft 9in 140lb star could reach with one drink.
For a first driving under the influence offence, there is no minimum jail sentence and a maximum of six months, a fine of 250 dollar (£150) to 500 dollar (£300), and 50 hours of community service.
For anyone under 21, there is an automatic six-month licence suspension.
Bieber left jail about an hour after his court appearance, popping through a window of his black SUV in a black hoody and sunglasses to wave to crowds of reporters and young girls waiting to see him.
Canadian-born Bieber was only 15 when his platinum-selling debut My World was released. The singer from Ontario had come second in a local singing contest two years earlier and began posting performances on YouTube, according to his official website. The videos caught the attention of a talent agent and eventually led to a recording contract.
He was positioned as clean-cut and charming - even singing for President Barack Obama and his family at Christmas - but problems began to multiply as he got older.
Bieber has been accused of wrongdoing in California but has never been arrested or charged. He is currently under investigation in a felony vandalism case after a neighbour reported the pop star threw eggs at his house and caused thousands of dollars of damage.
A neighbour had previously accused Bieber of spitting in his face, and a paparazzo called deputies after he said Bieber kicked him, but prosecutors declined to file charges in either instance.
He was also accused of reckless driving in his neighbourhood, but in October prosecutors refused to seek charges because it was unclear whether Bieber was driving.
His arrest in Miami is unlikely to affect the egg-throwing investigation, which included nearly a dozen detectives searching Bieber's home last week, searching for video surveillance and other evidence that could be used to pursue a vandalism charge.
Bieber is also being sued by a former bodyguard who says the singer repeatedly berated him, hit him in the chest and owes him more than 420,000 dollars (£250,000) in overtime and other wages. The case is scheduled to go to trial in Los Angeles next month.
Bieber's arrival in Florida earlier this week also is under investigation. An official says three Florida police officers have been suspended for giving Bieber an unauthorised escort from the airport.
Opa-locka Assistant City Manager David Chiverton said the officers were suspended with pay pending the outcome of an investigation.
Police escorts from the Opa-locka Executive Airport are not uncommon, but they must follow procedure.
Bieber was free on bail Friday after an arrest on charges of DUI, driving with an expired license and resisting arrest. Miami Beach police say Bieber smelled of alcohol when he was stopped after drag-racing down a residential street early Thursday.
Authorities in the suburban Miami city of Opa-locka are investigating whether the singer was given a police escort when he landed on Monday at the Opa-locka airport.
Police escorts from the airport are not uncommon, but they must follow procedure because they involve city vehicles, assistant city manager David Chiverton said. Administrators had not authorised any escort for Bieber in this case.
Despite all his legal troubles, the charges against Bieber probably will not put him at risk of being deported or denied entry into the US, said immigration lawyer Ira Kurzban.
According to US immigration law, authorities generally do not revoke an individual's visa unless the person has been convicted of a violent crime or has been sentenced to more than one year in prison.