For the first time in United States history, a bill has been signed into law by a mechanical autopen, which affixed the president’s signature at the direction of Mr. Obama, who is in Europe.

Congress on Thursday passed legislation extending the Patriot Act for four years. But with Mr. Obama abroad and the existing legal authorities set to expire, the White House concluded that a mechanical signature would do.