State Senator Eric Schneiderman narrowly defeated Nassau County District Attorney Kathleen Rice in the Democratic primary for state attorney general, thwarting attempts by Ms. Rice and his other opponents to paint the legislator as an Albany “insider” in a corrupt and ineffectual state government system.

Mr. Schneiderman defeated Ms. Rice 34 percent to 32 percent with three other Democrats finishing further back.