By Scott Malone and Elizabeth Barber

BOSTON (Reuters) - A man carjacked by the accused Boston Marathon bombers shortly after prosecutors say they shot and killed a policeman on Thursday recalled the moment when one of the brothers jumped into his Mercedes and told him he was one of the bombers.

Dun Meng testified that he had gone for a drive to relax after a long day at work on April 18, 2013, and had pulled over to check his phone when Tamerlan Tsarnaev tapped on his window, stepped into his car and pulled a gun.

"He pulled the magazine out of the gun to show me there's bullets in the gun. He told me, 'You know, I'm serious, so don't be stupid,'" Meng, who works at a tech company that develops cell phone apps for ordering food, said in federal court in Boston.

"After that, he asked me, 'Do you know the Boston Marathon explosion?' I said, 'Yes, I know.' He asked, 'Do you know who did it?' I said, "No, I don't.' He said. 'I did it and I just killed a policeman in Cambridge.'"

Tamerlan, 26, died later that night after he and younger brother Dzhokhar Tsarnaev engaged in a shootout with police in the Boston suburb of Watertown. The surviving Tsarnaev, 21, is accused of killing three people and injuring 264 with a pair of homemade bombs at the race's finish line on April 15, 2013.

Dzhokhar Tsarnaev could be sentenced to death if a jury finds him guilty of the attacks. His lawyers opened the trial last week by bluntly admitting that their client had carried out the attacks. They hope to spare him from the death penalty by convincing the jury that the older brother was the driving force behind the bombing.

Despite the admission, Tsarnaev has maintained his official "not guilty" plea, leaving it to federal prosecutors to first prove his guilt before the trial can move on to its second, sentencing phase.

Earlier on Thursday, the jury viewed autopsy photos of Sean Collier, a university police officer who prosecutors contend the brothers shot dead shortly before the carjacking, in an unsuccessful effort to steal his gun.

In the first five days of testimony, the full court viewed gruesome photos and video of the injuries caused by the pressure-cooker bombs that ripped through the crowd at the finish line, causing more than a dozen people to lose legs. But U.S. District Judge George O'Toole ordered autopsy photos of Collier, 27, to be shown only to the jury out of respect for his family.

Some jurors could be seen tearing up as they viewed the photos of Collier. The court also viewed pictures of blood pooled in his squad car's cup holders and on its floor.

Collier's death marked the start of a chaotic 24 hours. After Meng escaped the carjacking, when the pair stopped at a gas station, the Tsarnaevs hurled explosives at police during a gunfight.

The shooting ended when Dzhokhar Tsarnaev roared off in Meng's Mercedes, running over and killing his brother before disappearing into a drydocked boat in the Boston suburb of Watertown. Police found him the next evening, after a day-long lockdown of the Boston area when hundreds of thousands of people hid in their homes.

The bombing killed restaurant manager Krystle Campbell, 29, and graduate student Lingzi Lu, 23, as well as 8-year-old Martin Richard.

Meng said the most frightening moment of his carjacking came when he decided to escape while Dzhokhar shopped for snacks at a gas station and Tamerlan fussed with a navigation system.

"This seems the most terrifying moment, most difficult decision in my life," Meng said, adding that Tamerlan had told him he would not be killed. "I was struggling, should I trust him about that? Or should I take this chance by myself to run away?"

(Editing by Tom Brown)