Tupac Shakur, a rap performer who is standing trial on charges of sexual abuse in Manhattan, was shot five times early today as he and two companions walked into a recording studio in midtown, police said.

Mr. Shakur, 23, and the other men, who were not identified, were walking through the lobby of Quad Recording Studios at 723 Seventh Avenue, near 48th Street, about 12:25 A.M. when three men approached and demanded money, said Sgt. James Coleman, a Police Department spokesman.

It was not clear why the men then shot Mr. Shakur and one of his companions, the police said.

Mr. Shakur, who was struck twice in the head, twice in the groin and once in one hand, was taken to Bellevue Hospital Center where he was listed in guarded condition, said Wes Anglin, a hospital spokesman.

"He is alert," Mr. Anglin said, and his wounds were not believed to be life-threatening.

The second man was shot twice in the abdomen and was taken to St. Vincent's Hospital and Medical Center. His condition was not available early this morning. The third man with Mr. Shakur was not injured.

The three robbers fled after taking money or property from the three men, Sergeant Coleman said.

Mr. Shakur, who starred last year with Janet Jackson in the movie "Poetic Justice," has been standing trial with his road manager, Charles Fuller, on charges of sodomizing and sexually abusing a woman in the Parker Meridien Hotel last November.