LOS ANGELES — Two men from Maine pleaded not guilty on Wednesday to murder charges in the California shooting death of a homeless man in a Hollywood tourist area, in what police described as a possible drug deal gone awry.

Troy McVey, 22, and Coby Kronholm, 21, entered their pleas during a brief appearance in Los Angeles Superior Court, where they stood in jail jumpsuits behind a glass partition as McVey’s mother watched from the audience.

An attorney for McVey, the accused shooter, said his client was a student who had been visiting Hollywood with a friend on a road trip when the two were victimized by robbers. Police said the two young men from Maine were the attackers.

“The suspects aren’t talking and so it’s speculation, but we believe it may have been a drug deal gone bad and they may have even mistaken the victim for somebody,” said Los Angeles police Detective Mark Morgan.

The late-night shooting on Jan. 4 at a busy intersection in the Hollywood district of Los Angeles was witnessed by an off-duty officer and caught on surveillance video from multiple businesses.

McVey was seen smashing windows on a car before confronting Richard Miller, 52, a half block away, where the suspects said something about money, Morgan said. During the encounter, McVey shot Miller, police said.

The officer who witnessed the incident was in a car and followed McVey and Kronholm when they ran a short distance. Then he directed police to the site where the men were arrested, the detective said.

Outside court, McVey’s attorney gave a different description of the shooting, saying his client and Kronholm had just parked their car in Hollywood and were walking around the area when two men approached them and tried to rob them.

“The decedent will be found to have been the assailant in this case,” attorney Arthur Lindars said.

McVey was heard to say that he wanted his money back before the shooting, Lindars said. The other man who was with Miller ran away, he said.

Bail for the men has been set at $1 million each. They both face a maximum sentence of 25 years to life in prison if found guilty.