A man who was carjacked by alleged Boston marathon bombers Tamerlan and Dzhokhar Tsarnaev, after they had murdered an M.I.T. police officer testified in federal court Thursday about his ordeal.

Dun Meng, a Chinese immigrant and app designer testified that he had been out for a drive on the night of April 18, 2013, when he pulled his vehicle over in order to respond to a text message from a friend. Soon, a vehicle pulled up behind him and a man approached his window.

The man was Tamerlan Tsarnaev. “He asked me, ‘Do you know about the Boston Marathon explosion?’ I said, ‘Yes, I know,’” Meng said, according to a transcript of his testimony published in the Boston Globe. “He said, ‘I did it, and I just killed a policeman in Cambridge.’ ”

According to Meng's testimony, Tamerlan pointed a gun at him. “He pulled the magazine out of the gun to show me there’s bullets in the gun,” Meng said. “He told me: ‘You know, I’m serious, so don’t be stupid.’”

Meng testified that as Tamerlan drove him around, the now-deceased suspect told him: “I'm Muslim. Muslim hate Americans." Meng recalled his response as: "I'm Chinese. Chinese are very friendly to Muslims."

In his testimony, Meng said that Tamerlan pulled over in the Watertown area, and a green sedan pulled up behind them, whereupon the Tsarnaevs began loading items from the sedan into the rear of Meng's Mercedes SUV.

The green sedan's driver then got into the back seat of Meng's vehicle. Asked if he recognized the man in question, Meng said: "That gentleman right there," referring to Dzhokhar Tsarnaev, who sat facing him in court, NBC News reported.

After driving around and having the brothers remove cash from an ATM using his bank card, Meng saw his opportunity to flee when the trio pulled into a gas station.

Surveillance video released by prosecuting authorities shows Dzhokhar Tsarnaev exiting Meng's car and going into a convenience store associated with the gas station they stopped at.

This was the moment when Meng decided to run from his captors. “This was the most terrifying moment, the most difficult decision in my life,” he told a federal jury in Boston Thursday, according to the Boston Globe. “I dashed onto the street. I could feel he [Tamerlan] was trying to grab me.”

Video shows Meng fleeing across the street to another gas station, where the attendant calls 911.

During his ordeal, Meng had told Tamerlan that his car was not fitted with a GPS tracking system -- which was untrue. Soon after Meng gave police the account information for his vehicle, authorities were able to trace it to a street in Watertown, the New York Times reported.

During an ensuing firefight with police, Tamerlan was killed, and Dzhokhar fled. He was subsequently located hiding in a dry-docked boat and captured by police.

Dzhokhar is standing trial on 30 counts related to the bombing of the 2012 Boston marathon. Several of the charges he faces carry a potential death sentence.