In a rare display of political unity, President Trump on Monday signed a bipartisan bill that, for the first time, makes acts of animal cruelty a federal crime punishable with fines and up to seven years in prison.

The bill, called the Preventing Animal Cruelty and Torture Act, was introduced in the House this year by two Florida lawmakers — Representative Vern Buchanan , a Republican, and Representative Ted Deutch , a Democrat. It expands a 2010 law signed by President Barack Obama that banned videos that show animals being crushed, burned, drowned, suffocated, impaled or subjected to other forms of torture.

Now, intentional acts of cruelty shown in the videos are also felony offenses.

“It is important that we combat these heinous and sadistic acts of cruelty, which are totally unacceptable in a civilized society,” Mr. Trump said at a signing ceremony on Monday, where he was joined by Mr. Buchanan and animal rights advocates.

The bill was passed unanimously by a voice vote in the House in October. It was passed unanimously by the Senate in November and went into effect on Monday.