Amin al-Baroudi wanted to do the right thing in Syria, but knowing what the right thing is in a quagmire like the Syrian war isn't always easy.

Al-Baroudi, 50, of Irvine, California admits now that he went astray: In addition to performing humanitarian work, al-Baroudi also sneaked rifle scopes, night-vision goggles and other military gear to rebel fighters seeking to topple the regime of Syrian President Bashar al-Assad.

The problem, prosecutors say, is that the group Al-Baroudi was helping, Ahrar el-Sham, frequently fights alongside the al-Qaida affiliate in Syria, Jabhat al-Nusra.

On Friday, a judge sentenced al-Baroudi to nearly three years in prison for violating U.S. sanctions in Syria.

Al-Baroudi, a naturalized U.S. citizen who was born in Syria, apologized for his conduct at the hearing.

"I came to realize there's no right way to do the wrong things," al-Baroudi wrote in a statement that his lawyer, Anthony Capozzolo, read when Al-Baroudi became too choked up to maintain his composure. "I simply pray for my old country to exit this crisis and enjoy ... what my family enjoys in this country."

Capozzolo asked the judge for a sentence of probation or to sentence al-Baroudi to the six months' time he had already served since his arrest in December. He said al-Baroudi was motivated to act by his own life experience growing up in the town of Hama, where tens of thousands were massacred in 1982 by Assad's father, Hafez al-Assad.

"He's not a for-profit mercenary," Capozzolo said. "Mr. al-Baroudi was trying to help, although in a fully misguided way."

Prosecutors say al-Baroudi illegally exported the tactical gear to Syria from late 2011 to 2013. In 2013, al-Baroudi realized his actions were under scrutiny when he was stopped from boarding a flight back from Turkey to the United States. After that, al-Baroudi turned his efforts to purely humanitarian work, working with the humanitarian arm of a Syrian opposition coalition.

Assistant U.S. Attorney Julia Martinez did not dispute al-Baroudi's good intentions, and said the government took that into account in filing the charges, which allege a violation of sanctions rather than supporting a terrorist group. But she still argued for a sentence of nearly four years, saying his actions were dangerous.

"His knowledge about Syria made abundantly clear he knew how dangerous what he was doing was," Martinez said.

U.S. District Judge Liam O'Grady echoed prosecutors' concerns.

"You had no control over who was going to use those items" once they got into Syria, O'Grady said.

Federal prosecutors have found themselves prosecuting defendants on all sides of the Syrian conflict. Just this week at the federal courthouse in Alexandria, a grand jury indicted an individual who prosecutors say was part of the pro-Assad Syrian Electronic Army and helped hack computer accounts associated with perceived enemies of the regime.

On Thursday, a northern Virginia man, Mohamad Khweis, made an initial appearance on charges that he joined the Islamic State and spent time at a safe house in Syria where he expressed his willingness to serve as a suicide bomber.