LEWISTON, N.Y. (AP) — Kodak Black was arrested on drug and weapons charges as the rapper tried to cross from Canada into the United States near Niagara Falls, law enforcement officials said Thursday.

Black, whose legal name is Bill Kapri, was driving two other people in a Cadillac Escalade with temporary California registration across the Lewiston-Queenston International Bridge at 7:20 p.m. Wednesday, according to New York state police. It was unclear where the men in the Escalade and a second car were headed, but Black had been scheduled to perform that night in Boston, about 400 miles (640 kilometers) east.

The men told border agents that they had marijuana and firearms, U.S. Customs and Border Protection said in an emailed statement. State police, who were called in, said that Black was found to have marijuana, and a loaded Glock 9mm pistol was discovered in the vehicle. No one in the car had a permit for the pistol.

The 21-year-old rapper from Miramar, Florida, was arrested on charges of second-degree criminal possession of a weapon and unlawful possession of marijuana.

Black, who also faces a charge in South Carolina of first-degree criminal sexual misconduct on allegations he raped a woman after a 2016 concert, was arraigned in a town court and remanded to county jail.

A phone message seeking comment was left with Black’s attorney. Representatives at Black’s record label and Live Nation didn’t reply to emails seeking comment from The Associated Press.

Prosecutors said Thursday afternoon that Black was released from jail after posting bail, which was $20,000 cash or $40,000 bond. Video taken by WKBW-TV of Black walking to a car after posting bail shows him hiding his face with what appears to be a fan of $100 bills.

The two passengers in the Escalade face a weapons charge. The driver of the second car, a Porsche, faces marijuana and weapons charges after attempting to cross with three loaded handguns in the car, police said

The four men are due back in town court May 8.

Black’s hits include “Tunnel Vision,” ″Wake Up in the City” with Bruno Mars and Gucci Mane, “No Flockin’,” and “Zeze,” which peaked at No. 2 on Billboard Hot 100 chart. His last album, 2018′s “Dying to Live,” debuted at No. 1 on the charts.

In Boston, police responded to what they described as “generally unruly behavior” Wednesday night after Black’s scheduled shows at a city club were canceled.

Department spokesman Officer Stephen McNulty said police responded to the House of Blues on reports of a disturbance. One man was arrested for allegedly assaulting a member of the club’s security staff and two people required medical assistance.

Police say there were about 200 people outside the club and it took about 30 minutes to disperse the crowd.