Where in the world is President Obama? Turns out it doesn’t matter.

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. (House vote | Senate vote) But with Mr. Obama abroad and the existing legal authorities set to expire, the White House concluded that a mechanical signature would do.

“Failure to sign this legislation poses a significant risk to U.S. national security,” Nick Shapiro, an assistant press secretary in the White House, said before the vote on Thursday. “As long as Congress approves the extension, the president will direct the use of the autopen to sign it.”

With that declaration, Mr. Obama turned a machine that is ubiquitous in government and business for routine transactions — letters, ceremonial photos, promotional materials — into the ultimate stand-in replacement for the leader of the free world.

White House officials said this was the first time that Mr. Obama had used the autopen to sign a piece of legislation and added that the administration believed it was the first time that a president had used the device to turn a bill into law.

The White House had a staff member ready for several days to fly to Europe with a copy of the legislation for Mr. Obama to sign, but Congress delayed action longer than expected. Under pressure to make sure that no provisions of the Patriot Act lapsed for any time, lawyers researched the use of the mechanical device.

White House officials are apparently basing their legal conclusion on a memorandum written by the Justice Department under President George W. Bush in 2005, which concluded that “the president need not personally perform the physical act of affixing his signature to a bill to sign it.”

Instead, the president’s lawyers at the time decided, “we emphasize that we are not suggesting that the president may delegate the decision to approve and sign a bill, only that, having made this decision, he may direct a subordinate to affix the president’s signature to the bill.”

Still, despite that opinion, it appears that Mr. Bush never used the autopen to sign a bill.

As recently as December, when Congress passed legislation providing health care benefits to rescue workers in New York who responded to the Sept. 11 attacks, a staff member flew to Hawaii, where the president was vacationing, with a copy of the bill for Mr. Obama to sign.

“It came out with a member of the staff so that it could be signed in a timely fashion,” said Bill Burton, who was White House deputy press secretary at the time.

In 2005, Mr. Bush flew back to Washington through the night from his ranch in Texas so that he could sign a bill that was intended to force doctors to keep feeding Terri Schiavo, the comatose Florida woman whose husband was fighting to end her life.

Now, however, such a flight may no longer be necessary if presidents begin routinely signing legislation into law with the autopen.

Of course, an autopen signature might be politically dangerous for a president in some cases. And there are times when presidents are eager to stage elaborate signing ceremonies to highlight legislation that they have pushed for.

In those cases, presidents often use multiple pens to sign legislation so that they can give them to the legislative leaders or activists who helped get the bill passed.

It’s not clear that pens used by a machine would hold the same kind of meaning.