WASHINGTON — A former militia leader from Libya was convicted on Tuesday of terrorism charges arising from the 2012 attacks in Benghazi, Libya, that killed a United States ambassador and three other Americans. But he was acquitted of multiple counts of the most serious offense, murder.

The defendant, Ahmed Abu Khattala, 46, was the first person charged and prosecuted in the attacks, which took on broader significance as Republicans and conservative news outlets sought to use them to damage the presidential ambitions of Hillary Clinton, who was then the secretary of state. Yet the seven-week trial in federal court in Washington received relatively little attention from such quarters.

Mr. Khattala was convicted on four counts — including providing material support for terrorism, conspiracy to do so, destroying property and placing lives in jeopardy at the mission, and carrying a semiautomatic firearm during a crime of violence — but acquitted on 14 others. He faces life in prison.

The mixed verdict showed the difficulty of prosecuting terrorism cases when the evidence is not clear-cut. The outcome was reminiscent of the 2010 federal trial of Ahmed Khalfan Ghailani, a Tanzanian man and former Guantánamo Bay detainee who was charged in federal court as a conspirator in the 1998 bombings of two American embassies in East Africa that killed hundreds. Mr. Ghailani was acquitted of most of the charges, including each murder count for those who died, but he was still sentenced to life in prison for a conviction on one count of conspiracy.