A 25-year-old man charged in North Carolina with kidnapping and attempted rape who escaped Thursday afternoon from a cell in Annapolis District Court was arrested shortly before midnight, county police said.

Officers with the Anne Arundel County police, Annapolis police, Maryland State police, and the county sheriff's office were involved in the search for Bonrick Lee Barksdale since his escape about noon, said Anne Arundel police Lt. Francis Tewey.

Barksdale was apprehended before midnight near the intersection of Dewey Drive and Sumner Road in the Admiral Heights community, Tewey said in an email.

Barksdale had been held in a courthouse cell after he had been denied bail at an 11 a.m. hearing, and was waiting to be taken back to the county jail, Tewey said.

Barksdale reportedly asked a security guard for toilet paper. When she opened the door, Barksdale overpowered the guard and forced her to open other doors, Tewey said. Barksdale then ran toward the Admiral Heights neighborhood.

A deputy sheriff ran after Barksdale but was unable to catch him, Tewey said.

The overpowered guard works for Dunbar, a private company that provides security at the court building, Tewey said.

Anne Arundel homicide detectives had arrested Barksdale Aug. 26 on a warrant from North Carolina. He gave police an address on Dewey Drive, in the neighborhood police were scouring Thursday, when he was charged in July in Maryland with assault. He also has prior convictions in Maryland.

Baltimore Sun reporter Andrea F. Siegel contributed to this article.