An upstate appeals court has ruled that a defendant was the victim of a coercive arrangement in which prosecutors forced him to abandon a constitutional speedy trial motion in exchange for a guilty plea to second-degree robbery.

The Appellate Division, Third Department, said the manner in which Terrance Wright pleaded guilty represented the kind of “prosecutorial bartering” that the state Court of Appeals expressly condemned in People v. Blakley, 34 NY2d 311 (1974).

Where prosecutors make a defendant give up a yet-to-be-decided speedy trial motion as a condition of a plea, “the integrity of the judicial process has been undermined,” Justice Michael Lynch (See Profile) wrote for the court in People v. Wright, 105459.

“To make matters worse,” Lynch continued, Broome County prosecutors said their offer to allow Wright to plead guilty to robbery would expire as soon as a hearing on his speedy motion was set to begin. He accepted the deal and pleaded to the charge, the court noted.

The appeals panel faulted the trial judge, Broome County Judge Martin Smith (See Profile), for not stepping in to prevent the coercive situation.

“A trial court has a core obligation to recognize and prevent such an unfair tactic, but here the court simply reiterated the impermissible condition of the plea and waiver,” Lynch wrote.

The court ordered Wright’s guilty plea, for which Smith gave him eight years in prison as a second felony offender, to be vacated.

Justices Leslie Stein (See Profile), William McCarthy (See Profile), Elizabeth Garry (See Profile) and Eugene Devine (See Profile) joined in the ruling.

Police accused Wright of robbing a Binghamton cab driver in February 2008. He moved out of state and was not arraigned on the indictment until December 2011, giving rise to his speedy trial motion.