More than 45,000 people have signed a petition calling for the arrest and prosecution of former President Bill Clinton for what they alleged were violations of Massachusetts election laws — even though state officials have said he acted legally.

Leading up to his wife's victory over U.S. Sen Bernie Sanders of Vermont in the Massachusetts primary on Tuesday, the former president went inside a polling station in Boston, according to multiple reports. Hillary Clinton, a former secretary of state and senator, won by about 17,000 votes, according to NBC News.

Bill Clinton talked with poll workers and took a photo with a woman at the Holy Name Parish School's gymnasium in West Roxbury,The Boston Globe reported, citing press pool reports. The petition, posted on Change.org, charges that Bill Clinton made a "clear, knowing and egregious violation of the campaign laws to swing an election in a significant way."

He also entered a polling station in Newton and attended an event outside of a polling location in New Bedford, according to the Globe.