BALTIMORE, NOV. 19 -- A witness who was to testify against the man accused of shooting a U.S. Park Police officer was shot and killed early today, police reported.

Police said the victim, Antonio Johnson, 27, of Baltimore, was attacked and shot twice in the back about 1 a.m. as he walked near his home.

Johnson pleaded guilty Wednesday in U.S. District Court to a charge of being a convicted felon in possession of a firearm. The charge stemmed from the Aug. 21 shooting of U.S. Park Police Officer Patrick Gavin during a routine traffic stop near Riverdale in Prince George's County.

After the court hearing, he was freed on personal recognizance under conditions set by a federal magistrate last month.

Assistant U.S. Attorney Michael B. Middleton told Judge Alexander Harvey II that Johnson agreed to plead guilty and testify against Kendall C. Alexander, 23, who is accused of shooting Gavin along the Baltimore-Washington Parkway.

Alexander, indicted last month on five federal charges, is in custody on a state prison escape charge.

In return for Johnson's plea and cooperation, Middleton said, the government was to recommend no more than 30 months in prison for Johnson.

Neither police nor Middleton would say today if they believe Johnson's killing was related to his federal plea bargain.

Police said a late-model dark automobile, containing two men and cruising without headlights, pulled up next to Johnson. One man jumped from the automobile, grabbed Johnson and slammed him against a fence, police said.

When Johnson broke free and ran from the men, at least four shots were fired.

He died at Johns Hopkins Hospital several hours later.

Another codefendant, Laverne Sykes, 20, pleaded guilty today in federal court to possessing a weapon as a felon, a charge that also emanated from the Gavin shooting.

Middleton told Harvey that Johnson, Sykes and Alexander had a shotgun and two revolvers in their car when Gavin was shot, and that Johnson and Sykes saw the shooting.