Desperate Housewives star Eva Longoria has joined the cast of Brooklyn Nine-Nine.

According to The Wrap, the actress will play Sophia, a defence attorney who catches the eye of Andy Samberg's character Jake.

Longoria will put in a three-episode stint as Sophia, who comes up against Jake in court.

Also announced as guest stars for the upcoming season are Kyra Sedgwick and Terrell Owens.

Brooklyn Nine-Nine returns to Fox on September 28.