Glenn F. Ivey, the chief prosecutor in Prince George's County, and a second prominent county figure were apparently shot with a pellet gun yesterday as they stood in line at a carryout ice cream store, authorities said.

Ivey, 42, "was slightly injured" but did not require medical attention after the incident, which occurred at a store at Marlboro Pike and Gateway Drive in District Heights about 5 p.m., a spokesman for the prosecutor said.

Ivey's spokesman said the state's attorney had gone to the store with former delegate Rushern L. Baker III, a close friend. The spokesman said Baker was also hit by a pellet or BB.

No one has been arrested, and authorities said they had no motive and no suspects.

A spokeswoman for the county police said the pellet attack was "apparently a random incident" and is under investigation.

"Some kind of car with several teenagers in it drove by and Mr. Ivey was shot" with the pellet, according to Ivey's spokesman, Ramon Korionoff. He added that "there is no reason to believe at this time that anybody was out to get" Ivey.

Cpl. Debbi Carlson, a police spokeswoman, said that it was not clear whether a projectile was found.

According to Korionoff, the prosecutor was hit in the upper left arm. He said that a bandage appeared sufficient to treat the small wound and that further medical attention was not sought.

Korionoff said the projectile that struck Baker apparently hit his pants and did not break his skin.

He said that Baker and Ivey had attended a rally in Calvert County for Sen. John F. Kerry, the Democratic presidential nominee. They were on their way home when they decided to stop for ice cream, Korionoff said.

It was not clear how much Ivey saw of the assailants.

"He might have caught a glance out of his peripheral vision," Korionoff said. "He did not see fully who was in the car."

Ivey, a graduate of Princeton University and Harvard Law School, has been chief prosecutor in Prince George's for about 21 months. He has become one of the county's most prominent public officials, speaking on a variety of law enforcement-related issues rather than merely prosecuting cases.

A former Capitol Hill aide, he has been viewed in political circles as possibly having a future in higher office.

Baker, a former member of Maryland's House of Delegates, ran unsuccessfully in the Democratic primary for county executive against Jack B. Johnson (D). Johnson was Ivey's predecessor. Korionoff said Baker is executive director of an educational organization.

Staff writer Jamie Stockwell contributed to this report.

Glenn F. Ivey, above, and ex-delegate Rushern L. Baker III had stopped for ice cream while returning from a John Kerry rally in Calvert.