In a windowless attic in Washington, under a maze of exposed pipes, a group of U.S. diplomats is working on Libya. They study maps. They scan Arabic-language TV. They reach out to their contacts in embattled villages.

When the phones ring, they answer, “U.S. Embassy Tripoli.”

This makeshift office in a State Department annex, reachable by a freight elevator, is a ghost of the mission the diplomats were forced to abandon in February as Tripoli erupted in gunfire. “We have constituted, in effect, an Embassy Libya-on-the-Potomac,” said Gene Cretz, who still holds the title of U.S. ambassador.

The unconventional mission has kept together the handful of U.S. diplomats who have experience in Libya, and the group has provided critical information during the war on Moammar Gaddafi’s forces. But the attic has been the scene of anguish as well, as the diplomats have watched the destruction of their embassy compound and worried about the fate of their Libyan staff and friends.

“When the fighting was really kind of bad, we were getting calls daily from people in Libya saying: ‘Oh, my God, Gaddafi forces are at the foot of the mountains — they’re going to kill us. Please help us!’ ” recalled Joan Polaschik, the deputy chief of mission. “That was stressful and horrible.”

Lt. Col. Brian Linville, of Embassy Tripoli’s Defense Attache Office, hands charge d’affairs Joan Polaschik the last U.S. flag to fly over Embassy Tripoli on Feb. 25. (Photo by Todd Cheng/US EMBASSY TRIPOLI)

Several other U.S. embassies in the region have been partially evacuated during the Arab Spring protests. But the embassy in Tripoli shut completely — the first U.S. mission to do so in 12 years, Polaschik said. She stayed up the night before the final evacuation, destroying computers.

After a hair-raising escape from Libya — in which the U.S. diplomats split up between a ferry and a plane, with a single suitcase each — they eventually reunited in Washington, eager to continue their work. But bureaucratic regulations don’t allow for a U.S. embassy in Foggy Bottom.

Still, with the U.S. government desperate for expertise on Libya, the embassy was allowed to re-create itself — sort of. Few other people in the Foreign Service knew Libya, which had had hostile relations with Washington for decades, until it renounced terrorism and its nuclear weapons ambitions in 2004. Before Cretz arrived in late 2008, there had been no U.S. ambassador in Tripoli for 36 years.

The diplomats “are people who for two years had a hands-on feel for what was going on in Libya, to the extent anyone could know it,” Cretz said. “They have provided an important piece of the puzzle” to policymakers.

The orphan embassy also has provided key contacts.

On a Tuesday night in March, cultural officer Jared Caplan was returning to his temporary digs in Dupont Circle after happy hour when his cellphone rang. On the other end was the owner of an English-language school in Benghazi that had received U.S. educational grants.

“Hold on,” the man told Caplan. “There’s someone you need to talk to.”

The Libyan passed the phone to a U.S. Air Force officer whose F-15 fighter jet had just crashed outside Benghazi. He had been rescued by local villagers.

It was, Caplan recalled, “surreal.”

He rang the State Department, which connected the officer to the Defense Department. (The Pentagon has provided few details of the officer’s rescue, but Secretary of State Hillary Rodham Clinton has publicly attributed it to the school owner.)

Among rebels, familiar faces

As the U.S. government struggled to understand who the Libyan rebels were, the diplomats recognized some surprising old contacts. A number of opposition leaders, it turned out, had participated in the U.S. Embassy’s archaeology, education and commercial law programs — even its space camp aimed at children.

“The public-affairs section knew them best,” said Natalie A. Baker, the political officer. “It’s been really interesting to see how our embassy has evolved.”

Some of the U.S. diplomats initially believed that Gaddafi would quickly fall and that they would soon return to Tripoli.

But gradually, a more depressing reality set in. A mob ransacked the abandoned embassy buildings May 1. The diplomats later watched the attack on YouTube.

“That was the saddest point,” Cretz said. “At least there was a hope up until then that we could go back. That kind of brought home the reality — if we went back, we would have to start at ground zero again.”

One of Cretz’s priorities had been setting up a full-fledged embassy in Tripoli for the diplomats, who had been working out of makeshift offices and a hotel. “That embassy compound meant so much to us. We had moved five times in two years. That was our embassy,” said Josh Baker, the public affairs officer, who is Natalie Baker’s husband.

The sense of loss goes beyond the compound. Diplomats left behind their homes, along with their children’s toys, their wedding albums, their books and clothes.

“We set up this whole nursery for our newborn . . . there’s that nursery just sitting there” in Tripoli, said Joe Giordono-Scholz, the public information officer. Now, “we’re in some short-term rental apartment, with a rented crib.”

Time running short

Even the embassy-in-exile may soon cease to exist.

The diplomats continue to work on political analysis and planning for Libya’s eventual reconstruction. Some travel to Benghazi to help the temporary U.S. mission that has opened there. But State Department regulations allow diplomats to remain on evacuation status for only 180 days.

That clock is due to run out in August. Already, some of the younger officers are being told by the department to seek new assignments so they can fulfill requirements that diplomats spend a certain percentage of their time working overseas.

“Sadly, I think we’re going to have to disband the embassy,” Polaschik said, sighing.

Several diplomats said their sense of personal loss was tempered by the sacrifices that Libyans are making in the fight against Gaddafi.

“If in fact we’re able to contribute to a Libya that could emerge out of this as a democratic nation, that wouldn’t be such a bad epitaph,” Cretz said.