ISLAMABAD, Pakistan — A Pakistani court on Saturday acquitted four men accused of assisting Faisal Shahzad, the Taliban-trained militant who tried to explode a car bomb in Times Square two years ago, a lawyer and several relatives said.

Malik Imran Safdar, a lawyer for one of the men, said prosecutors had failed to prove their case against the defendants during a 20-month trial that was conducted partly inside a jail.

“They are feeling so relaxed, so comfortable and so satisfied,” he said. “But their families have suffered a lot.”

The four men — Muhammad Shouaib Mughal, Shahid Hussain, Humbal Akhtar and Faisal Abbasi — were arrested in Pakistan shortly after Mr. Shahzad, a naturalized American citizen of Pakistani origin, tried to detonate an S.U.V. packed with explosives in Times Square on May 1, 2010. The bomb, which did not go off, was deactivated by the police in New York.