A piece of metal breaking loose from a power line 43 miles southeast of the District momentarily knocked out electricity to the White House, State Department and wide swaths of the nation’s capital and Maryland suburbs early Tuesday afternoon.

But many in the city barely noticed.

The outage threw scores of public and private office buildings off the grid, but in most cases, the lights stayed on because backup generators kicked in.

That wasn’t true everywhere. A dozen people were trapped in stalled elevators, passengers were left searching for exits in darkened underground Metro stations, and a building full of Department of Energy employees and the main campus of the University of Maryland closed their doors. Thousands of visitors at Smithsonian museums on the Mall had to leave for hours. While the outage caused little more than a blip for many others, it took most of the afternoon to fully restore electricity.

The outage immediately caught the attention of national security officials, who have heightened their scrutiny of vulnerabilities of the U.S. electricity grid after recent reports that nations such as China and Iran have infiltrated U.S. power company networks.

Homeland security officials concluded Tuesday that terrorism had played no part in an outage that was quickly blamed on the failure of a simple piece of transmission equipment in southern Maryland.

Energy experts cast Tuesday’s event as a mundane occurrence that happens daily on a small scale.

Rarely, and memorably, it occurs on a larger scale, said Michael J. Assante, an electric power industry expert and director at the SANS Institute, a cybersecurity training organization. One example: the 2003 power outage in the Northeast that resulted in 50 million people losing electricity for up to two days — the biggest blackout in North American history.

In that incident, multiple major electricity lines failed, causing a domino effect from the Midwest into Canada and the Northeast.

On Tuesday, the system worked. Just one line failed, and the system recovered soon after the ripples were felt in the District. Parts of the electrical grid disconnected themselves to prevent further damage.

“It disconnected the lines, power plants and generating units when it sensed a problem,” said Ray E. Dotter, a spokesman for PJM Interconnection, which coordinates the flow of electricity in 13 states and the District. Dotter said the fluctuation in the voltage probably left some in the D.C. area experiencing a power loss and others a power surge. “Those are protective measures. . . . It is easier to reset a system than replace.”

Similarly, although the failure was felt widely in the District because of the number of agencies and organizations that run critical computer networks, buildings housing those networks automatically disconnected from the grid when fluctuations were sensed.

For many, the disruption was brief. Lights dimmed for a few seconds in some areas and not at all in others, according to accounts.

For others, the power interruption caused more disruption.

Prince George’s County firefighters freed 12 people stuck in six elevators at the University of Maryland at College Park, while campus engineers also may have released others, said Mark Brady, a spokesman for the county fire department. University officials closed the entire campus at 2 p.m. as many buildings remained dark.

The outage also affected the Justice Department, State Department and Smithsonian museums, where hordes of visitors in town for spring break vacations waited for more than two hours for some museums to reopen.

A couple of blocks from the White House, the lights went off for about 30 seconds at the Warner Theatre as Oprah Winfrey delivered a speech honoring Maya Angelou during the dedication of a new postage stamp. After a few seconds, the sound system began to work again, and Winfrey continued her delivery until the lights returned.

As the evening commute neared, D.C. police warned of heavy traffic leaving the city with signal lights still not functioning at more than a dozen key intersections.

Chris T. Geldart, director of the D.C. Homeland Security and Emergency Management Agency, characterized the unusual incident as a broad “power surge” that sent any District facility with a critical operation to emergency backup power.

That appeared to include the White House, State Department and many District offices. The Wilson Building, which houses the offices of the mayor and D.C. Council, was evacuated until backup power kicked on.

President Obama was in the Oval Office during the outage, but White House press secretary Josh Earnest said there was no sense there of any problem.

Some White House staff offices at the Eisenhower Executive Office Building were affected. Earnest said it was not clear how many offices in the West Wing were affected.

Across the city, several Metro stations went dark, then switched to emergency power.

Metro riders disembarking at Dupont Circle about 1 p.m. expressed delight on seeing exit fare machines that had been rendered useless by the power failure. But that delight turned to huffs and groans on the station’s immobile escalator as customers made the steep climb to the street. One man paused halfway up, declaring: “Time for a break.”

The Bethesda Metro station reopened around 9:15 p.m. Tuesday after a shutdown that Metro officials attributed to the afternoon’s widespread power failure.

Only two entrance escalators were available Tuesday and when one shut down, it was necessary to close the station for safety reasons, Metro spokesman Dan Stessel said.

Outside some downtown restaurants and offices, crowds lingered near darkened buildings while others closed early.

After 3 p.m., Pepco reported just over 800 customers still without power.

Tuesday’s interruption occurred, according to the Southern Maryland Electric Cooperative, when a Pepco transmission conductor in Mechanicsville, Md., “broke free from its support structure and fell to the ground.”

The failure on the 230,000-kilovolt Pepco line cut the supply to two power stations run by SMECO, a distribution cooperative that serves parts of the Maryland suburbs, and to two other key connection points in Pepco’s system.

Pepco, the District’s electricity utility, said in a statement that the company experienced an “issue” with a transmission line. Firefighters who arrived at the scene found a small brush fire surrounding the area where a transmission line connects with a substation.

Ellen Nakashima, David Nakamura, Arelis Hernández, Lynh Bui, Peter Hermann, Abigail Hauslohner, Lisa Rein and Martin Weil contributed to this report.