BALTIMORE (AP) _ Still reeling from a pair of riots, Maryland's aging and overcrowded prison system is under fire again - this time over the discovery that scores of inmates had gotten ''lost'' behind bars for months.

Ninety-three defendants were found languishing in the former Baltimore city jail for up to a year without being charged because of record-keeping errors.

One homeless man spent 13 months waiting for a hearing because officials thought he had been released. Another man spent five months behind bars for two traffic violations.

''Nobody knew I existed,'' said Martin Henn, the homeless man freed last week after an arson case against him was dropped. ''It's hell spending a year looking at a wall without a penny, without getting a letter or a visitor.''

State officials and inmate advocates blame the confusion on the soaring number of people behind bars, an increase caused largely by drug crime. Many other states face similar difficulties, they say.

''I think what it is telling us is that in the drug war what we are doing is flooding the system to such a degree that it is impossible to manage,'' said Stuart Comstock-Gay, director of the Maryland chapter of the American Civil Liberties Union. ''Maybe we need to rethink that.''

There are about 18,300 prisoners in the Maryland penal system and that figure is growing by about 110 a month.

The former Baltimore City Jail - now run by the state - operates under a population cap set by a federal judge to prevent overcrowding.

The Maryland Penitentiary in Baltimore, which has a capacity of about 850 inmates, has more than 1,000. There are about 1,600 inmates at the Maryland Correctional Institution near Hagerstown, which was built for 1,088.

Inmates at the 180-year-old penitentiary rioted in July 16 after guards foiled an attempt by an undisclosed number of prisoners to scale a wall. Inmates took two guards hostage and seized control of their wing.

Inmates at the prison, the oldest in continuous use in the nation, have repeatedly complained of overcrowding and poor food.

In May, 14 guards and 44 prisoners were injured when 1,000 inmates went on a daylong rampage that caused $1.2 million in damage at the Correctional Institution. Inmates said the riot was prompted by beatings by guards.

The former Baltimore jail was taken over by the state in July after the city said it couldn't afford to run it. The jail was built in 1806.

The jail has 2,700 prisoners, about 85 percent awaiting trial. The rest are serving time for minor crimes. The jail has a population cap of 2,813.

''We're trying to operate a 1990s criminal justice system on a 1950s chassis and it just won't fit,'' said Stuart Simms, state's attorney for the city of Baltimore.

The state has approved a 10-year, $500 million prison construction program, but Bishop Robinson, secretary of public safety and correctional services, has said already it won't be enough.

''I would rather build schools than build prisons, but the fact of the matter is we have a very substantial problem in the community largely driven by illegal drugs,'' said Delegate Charles Ryan, chairman of the state House Appropriations Committee.