About a half-hour after militants overran the U.S. diplomatic mission in Benghazi, Libya, last month, the State Department notified officials at the White House and elsewhere that the compound was “under attack” by about 20 armed assailants, e-mails obtained by The Washington Post on Wednesday show.

Two hours later, the State Department reported that the Libyan militia group Ansar al-Sharia had asserted responsibility on Facebook and Twitter and had also called for an attack on the U.S. Embassy in Tripoli.

The brief, unclassified e-mails from the State Department Operations Center do not discuss the origin of the Sept. 11 attack or mention any protest or demonstration at the mission before the assault.

Republicans including presidential challenger Mitt Romney have questioned whether the White House falsely ascribed the attack that killed U.S. Ambassador J. Christopher Stevens and three other Americans to a protest rather than to a planned terrorist attack.

“Embassy Tripoli reports approximately 20 armed people fired shots; explosions have been heard as well,” the center wrote at 4:05 p.m, or 10:05 p.m. Libyan time.

The State Department has previously said the assault began about 9:40 p.m. Libyan time.

“Ambassador Stevens, who is currently in Benghazi, and four [diplomatic] personnel are in the compound safe haven,” the e-mail from the command center in Washington said.

The reference to Ansar al-Sharia may fuel Republican efforts to show that the White House had evidence of terrorism almost immediately but sat on it. Five days after the attack, U.S. Ambassador to the United Nations Susan E. Rice said the attack appeared to have grown out of a “spontaneous” protest over an anti-Muslim video.

The Obama administration has said it relied on intelligence assessments that were incomplete and that shifted over several days, and it has categorically denied any effort to play down terrorism that could mar President Obama’s security record.

“Posting something on Facebook is not in and of itself evidence” of terrorist involvement, Secretary of State Hillary Rodham Clinton said when asked about the e-mails Wednesday. “I think it just underscores how fluid the reporting was at the time and continued for some time to be.”

The day after the attack, Obama cast it generally as among “acts of terror” that would not sway U.S. resolve. It was several more days before any official fully called it terrorism, and some time after that before the White House said the attack was not the result of a protest in Benghazi.

Also Wednesday, the Tunisian government confirmed that it has detained a 28-year-old Tunisian reportedly linked to the attack in Benghazi.

Ali Harzi and another man were detained in Turkey shortly after the attack and were returned to Tunisia. The Associated Press quoted Tunisian Interior Ministry spokesman Tarrouch Khaled as saying Harzi’s “case is in the hands of justice.”

Earlier this month, Defense Secretary Leon E. Panetta said the United States was looking into the arrests of the two Tunisian men, but it is not clear whether U.S. law enforcement officials have been able to question them.

Harzi is suspected of ties to extremist groups, including al-Qaeda’s affiliate in North Africa.

U.S. intelligence officials said the assertion of responsibility by Ansar al-Sharia was part of a flurry of often conflicting signals that surfaced in the aftermath of the attack and would have been viewed by analysts with skepticism.

The officials noted that the organization withdrew its assertion a day later and that militant groups frequently make unfounded claims about attacks.

A statement released by a U.S. intelligence official on Friday said that “a key question early on was whether extremists took over a crowd or if the guys who showed up were all militants. It took time — until that next week — to sort through varied and sometimes conflicting accounts to understand the group’s overall composition.”

The e-mails released Wednesday were sent to the White House Situation Room and to officials in intelligence and law enforcement, said a government source who spoke on the condition of anonymity because the e-mails are sensitive.

Portions of e-mail addresses that would identify individual recipients were redacted from copies originally reported on by Reuters and later obtained by The Post.

At 4:54 p.m., or 10:54 p.m. in Libya, the Operations Center advised that the firing had stopped “and the compound has been cleared.”

A State Department timeline provided to reporters earlier said that the street outside the compound was quiet until gunfire and an explosion were heard at 9:40 p.m. and that the compound was quickly overrun by a large armed crowd that set fire to the villa where Stevens was hiding in a fortified inner room.

Stevens apparently died of smoke inhalation inside the villa. Information officer Sean Smith also died in the villa. Two security employees died when a second U.S. government compound was attacked a short distance away.

Clinton suggested Wednesday that the e-mails do not tell the whole story. An independent investigation “is already hard at work looking at everything — not cherry-picking one story here or one document there,” she said.

Greg Miller and Julie Tate contributed to this report.