A former Democratic majority leader of the New York state Senate was sentenced on Wednesday to seven years in prison after a jury convicted him of attempting to bribe his way onto the GOP ballot in the 2013 New York City mayoral race.

Former Sen. Malcolm Smith, who represented a portion of southeast Queens, was convicted in February of federal corruption charges, including conspiracy, wire fraud, bribery and extortion.

“I’ve...