A brutal ex-con threw his Manhattan sex assault trial into turmoil today — calling his lawyer a “terrorist,” demanding to represent himself, threatening to defecate in the courtroom and bizarrely starting, then scuttling, a guilty plea by claiming he’d been bribed into it.

“You’ve played this game long enough,” an angry Manhattan Supreme Court Justice Gregory Carro told Marquis Phillips, who is charged with repeatedly punching and sodomizing a teenaged girl in the elevator and stairwell of her Harlem housing project last August.

Phillips’ antics all occurred outside the presence of the jury and the victim, whose testimony was delayed. “He told me he would kill me,” she bravely told jurors, a few of whom visibly winced at elevator surveillance tape of the brutal attack’s first moments.

Asked by prosecutor Rena Paul to estimate the time duration of the assault, the teen answered, “For me, it seemed like it lasted forever.”

The teen’s testimony continues tomorrow with cross examination by defense lawyer Seema Iyer, who he’d oddly called a “Muslim terrorist” and accused of promising to put money in his commissary for life if he took a plea deal.