Mr. Peralta was first elected to the State Senate in 2010 in a special election, defeating Hiram Monserrate, who was expelled from the Senate after being convicted of assaulting his companion.

As a lawmaker, Mr. Peralta was a champion of the Dream Act, legislation that would allow undocumented immigrants to qualify for college tuition assistance. He also introduced bills to legalize hoverboards in the city and to extend the time that speed cameras are used in school zones.

[What you need to know to start your day: Get New York Today in your inbox.]

Mr. Peralta, a resident of Queens for three decades, began his political career there as a community liaison to the State Assembly, the legislature’s lower house. He went on to win a seat in that body and served there for eight years.

Mr. Peralta’s campaign to become Queens borough president was derailed in 2013 when he was recorded by a state legislator in her role as an informant for the Federal Bureau of Investigation. The legislator, Shirley L. Huntley, was under investigation for corruption and hoped that cooperating with the F.B.I. by recording public officials whom she suspected were corrupt would help her case.

Mr. Peralta was not charged or accused of wrongdoing.

José Rafael Peralta was born on Nov. 10, 1971, in New York City to parents who had emigrated from the Dominican Republic. He attended public schools in Queens and graduated from Queens College, where he studied psychology and sociology and served as student body president.