WORCESTER - Clearly agitated at times by the questions asked of him, Gerald Jones testified Thursday that he was assaulted by Officer Michael J. Motyka while handcuffed and shackled in a holding cell at police headquarters on the morning of Dec. 1, 2014.

Officer Motyka, who has since retired from the Worcester Police Department, is on trial in Worcester Superior Court on a charge of assault and battery with a dangerous weapon (shod foot) in connection with the alleged attack. Judge Richard T. Tucker is presiding over the jury-waived trial, which is scheduled to resume May 25.

The 50-year-old Mr. Jones, who said he was now homeless, was called to the witness stand Thursday by Mr. Motyka's lawyer, James J. Gribouski. Mr. Jones was removed from the courtroom Wednesday after uttering profanities, accusing people of being racist and vowing not to testify despite the issuance of a bench warrant to assure his appearance as a witness in the case.

After being held in custody overnight, Mr. Jones was called to the stand again Thursday morning. His testimony was cut short by Judge Tucker, however, after Mr. Jones failed to follow the judge's instructions to simply answer the questions posed to him without making "speeches." Mr. Jones' testimony resumed after a brief recess.

Prosecutors from the office of Attorney General Maura Healey allege that Officer Motyka "lost his cool" over derogatory statements Mr. Jones was directing at him and his fellow officers and attacked him without justification. The defense contends the 52-year-old Gulf War veteran went into the cell to search Mr. Jones for a possible weapon and acted in self-defense after being struck in the face by him.

Under questioning by Mr. Gribouski, Mr. Jones acknowledged that he has a long criminal record and now has a breaking and entering case pending against him in Newton District Court. He denied Mr. Gribouski's suggestion that he was hoping prosecutors would "put in a good word" for him in his pending case in exchange for his testimony against Mr. Motyka.

"So, when things don't go your way, you immediately call everybody racist, don't you?" Mr. Gribouski asked Mr. Jones, who is black.

"No. Who's everybody?" asked Mr. Jones, who has accused Officer Motyka of directing racial epithets at him prior to the alleged assault. Mr. Jones and his lawyer received a $225,000 settlement from the city in connection with the case.

Under further questioning, Mr. Jones agreed that he recently left a voice message for representatives of the attorney general's office accusing them of being racist because they did not help him get into a homeless shelter and that he once filed a civil rights complaint against a Catholic priest and another individual who run a soup kitchen for the underprivileged.

At times, Mr. Jones questioned the relevance of Mr. Gribsouki's questions, asking what they had to do with the fact that Officer Motyka allegedly assaulted him while he was handcuffed and shackled and directed racial slurs at him.

He admitted that he was using crack cocaine, alcohol and marijuana in late 2014, but said he had been "on the road to recovery" for about the last month, with a couple of "relapses." He also denied that he was experiencing withdrawal symptoms at the time of the alleged assault.

In his opening statement in the case, Mr. Gribouski said his client went into the cell to search Mr. Jones after seeing him with his hands down his pants and suspecting he might have been in possession of contraband or a weapon.

When asked by the defense lawyer Thursday why he put his hands down his pants on the day in question, Mr. Jones responded facetiously, "I was going to get my gun so I could shoot him." He then said he was probably pulling his pants up because his belt had been taken from him.

Mr. Jones denied Mr. Gribouski's suggestion that Officer Motyka entered the cell to search him.

"He punched me in the stomach. When I hit the ground, he started kicking me, like a coward," Mr. Jones testified. He also denied striking or kicking the officer.

"I fell to the ground trying to cover myself up from his onslaught of punches and kicks," Mr. Jones said.

Mr. Jones pointed at Mr. Motyka, who was sitting at the defense table, when Assistant Attorney General Terrence M. Reidy asked him on cross-examination whether he saw the officer who attacked him.

"I thought he was going to kill me," he said.

Mr. Jones agreed under questioning by Mr. Reidy that he has had a history of drug and alcohol problems and mental health issues and conceded that he can be "difficult to deal with at times." He denied that he ever assaulted Officer Motyka on the morning in question, however.

"What am I, Bruce Lee? I'm handcuffed behind my back," he said.

Judge Tucker then pointed out to him that although he repeatedly testified that his hands were cuffed behind his back when he was placed in the holding cell, a surveillance video entered into evidence showed that his hands were cuffed in front of him.

"I was still helpless," Mr. Jones said.

The video showed Officer Motyka entering the holding cell and emerging a short time later , but there was no camera inside the cell to record what transpired there.

Mr. Jones apologized to the judge for Wednesday's "outburst" at the conclusion of his testimony.