An American and an Italian held hostage by al-Qaida, as well as two Americans working with the terror group, were inadvertently killed by CIA drone strikes early this year, the government revealed Thursday.

President Barack Obama said he took full responsibility for the counterterror missions and offered his “grief and condolences” to the families of the hostages, Warren Weinstein of Rockville, Md., and Giovanni Lo Porto.

Obama defended the legality of the January drone strike that killed the hostages and said there had been no evidence that the two men were present at what the U.S. had determined was an al-Qaida compound in Pakistan.

“Based on the intelligence that we had obtained at the time, including hundreds of hours of surveillance, we believed that this was an al-Qaida compound, that no civilians were present and that capturing these terrorists was not possible,” Obama said at the White House. “And we do believe that the operation did take out dangerous members of al-Qaida.”

Among those believed killed in the strike was Ahmed Farouq, who the White House said was an American who was an al-Qaida leader. U.S. officials have also concluded that Adam Gadahn, an American who had served as a spokesman for the terror network, was killed in a separate operation in January.

RELATED: Adam Gadahn writes on Arab News why he became a Muslim

A U.S. official said Farouq was a dual US-Pakistani national who was an al-Qaida operations leader in Pakistan. He had assumed the title of deputy emir of al-Qaida in the Indian Subcontinent, a relatively new offshoot of the terror group.

AQIS claimed responsibility for a failed attempt in September 2014 to hijack Pakistani naval vessels and use them to attack American warships. The U.S. believes Farouq was involved in that plot.

Gadahn, 36, the grandson of a Santa Ana doctor who founded a local pro-Israel peace group, was raised in Riverside County on a goat farm before moving to Orange County in the 1990s. He left Orange County in 1998, after he was radicalized at a Garden Grove mosque. He last appeared in a video in March 2010, when erroneous reports surfaced that he had been arrested in Pakistan.

Also known as “Azzam the American,” Gadahn denounced U.S. moves in Afghanistan and elsewhere, and threatened attacks on Western interests abroad. In 2006, he was charged with treason for acting as al-Qaida’s mouthpiece in videos and other recordings. His work led to Gadahn becoming the only American charged with treason since the World War II era.

He had been wanted by the FBI since 2004, and there was a $1 million reward offered for information leading to his arrest or conviction.

Gadahn was born in 1978 in Oregon as Adam Pearlman. His father, a musician in California, changed his name from Pearlman to Gadahn in the 1970s, and the boy was home-schooled and was raised as a Protestant Christian in rural Winchester.

In 1995, at age 17, he converted to Islam at a mosque in Orange County. in 1998, he moved to Pakistan, where he joined al-Qaida as a propagandist.

The White House said neither Farouq nor Gadahn were intentionally targeted in the strikes and the U.S. did not have information indicating their presence at the site of the operations.

U.S. government officials said the CIA carried out the drone strikes on Jan. 14 and Jan. 19 in Pakistan. The White House said the strikes happened in the border region between Afghanistan and Pakistan.

The officials were not authorized to discuss details of the attacks and spoke on condition of anonymity.

The president made no mention of Farouq and Gadahn. Instead, he focused his remarks on Weinstein, who had been held by al-Qaida since 2011, and Lo Porto, who had been held since 2012.

Obama expressed regret for the deaths of the two men and offered condolences to their families.

“I realize there are no words that can ever equal their loss,” said Obama, adding that he had spoken with Weinstein’s wife and Italian Prime Minister Matteo Renzi.

Weinstein, a 73-year-old development worker, was abducted in August 2011. His capture came four days before his seven-year stint with the U.S. Agency for International Development was to end.

In a message released previously in English and Arabic and addressed to Weinstein’s family, al-Qaida had said it was “not interested in keeping” Weinstein but wanted to exchange him for prisoners in U.S. custody.

Lo Porto was an Italian aid worker who worked for the German aid group Welthungerhilfe. He went missing in Pakistan in January 2012.

A spokeswoman for the aid group said the organization was shocked at the news of Lo Porto’s death.

“We’re shattered by today’s news,” Simone Pott told The Associated Press. “So much was done to try and get him released,” she said, without elaborating.

Lo Porto had joined the aid group in October 2011 and was working as a project manager in Pakistan’s Multan region when he was kidnapped together with German Bernd Muehlenbeck.

Muehlenbeck was freed last year under circumstances that Pott declined to comment on.

Renzi expressed his “profound pain” over Lo Porto’s death, saying the aid worker had “dedicated his life to the service of others.”

The Riverside Press-Enterprise contributed to this report.