SAUL LOEB/AFP/Getty Images(WASHINGTON) -- In a significant failure for the United States in the Mideast, more than a dozen spies working for the CIA in Iran and Lebanon have been caught and the U.S. government fears they will be or have been executed, according to four current and former U.S. officials with connections to the intelligence community.

The spies were paid informants recruited by the CIA for two distinct espionage rings targeting Iran and the Beirut-based Hezbollah organization, considered by the U.S. to be a terror group backed by Iran.

"Espionage is a risky business," a U.S. official briefed on the developments told ABC News, confirming the loss of the unspecified number of spies over the last six months.

"Many risks lead to wins, but some result in occasional setbacks," the official said.

Robert Baer, a former senior CIA officer who worked against Hezbollah while stationed in Beirut in the 1980s, said Hezbollah typically executes individuals suspected of or caught spying.

"If they were genuine spies, spying against Hezbollah, I don't think we'll ever see them again," he said. "These guys are very, very vicious and unforgiving."

Other current and former officials said the discovery of the two U.S. spy rings occurred separately, but amounted to a setback of significant proportions in efforts to track the activities of the Iranian nuclear program and the intentions of Hezbollah against Israel.

"Remember, this group was responsible for killing more Americans than any other terrorist group before 9/11," said a U.S. official. The Hezbollah-linked attacks on the U.S. embassy and Marine barracks in Beirut in 1983 killed more than 300 people, including nearly 260 Americans.

The U.S. official, speaking for the record but without attribution, gave grudging credit to the efforts of Iran and Hezbollah to detect and expose U.S. and Israeli espionage.

"Collecting sensitive information on adversaries who are aggressively trying to uncover spies in their midst will always be fraught with risk," said the U.S. official briefed on the spy ring bust.

But others inside the American intelligence community say sloppy "tradecraft" -- the method of covert operations -- by the CIA is also to blame for the disruption of the vital spy networks.

In Beirut, two Hezbollah double agents pretended to go to work for the CIA. Hezbollah then learned of the restaurant where multiple CIA officers were meeting with several agents, according to the four current and former officials briefed on the case. The CIA used the codeword "PIZZA" when discussing where to meet with the agents, according to U.S. officials. Two former officials describe the location as a Beirut Pizza Hut. A current U.S. official denied that CIA officers met their agents at Pizza Hut.

From there, Hezbollah's internal security arm identified at least a dozen informants, and the identities of several CIA case officers. Hezbollah then began to "roll up" much of the CIA's network against the terror group, the officials said.

One former senior intelligence official told ABC News that CIA officers ignored warnings that the operation could be compromised by using the same location for meetings with multiple assets.

"We were lazy and the CIA is now flying blind against Hezbollah," the former official said.

At about the same time that Hezbollah was identifying the CIA network in Lebanon, Iranian intelligence agents discovered a secret Internet communication method used by CIA-paid assets in Iran.

The CIA has yet to determine precisely how many of its assets were compromised in Iran, but the number could be in the dozens, according to one current and one former U.S. intelligence official.

The exposure of the two spy networks was first announced in widely ignored televised statements by Iranian and Hezbollah leaders. U.S. officials tell ABC News that much of what was broadcast was, in fact, true.

Hezbollah's leader, Sayyed Hasan Nasrallah, announced in June of this year that two high-ranking members of Hezbollah had been exposed as CIA spies, leading U.S. officials to conclude that the entire network inside Hezbollah had been compromised.

In Iran, intelligence minister Heidar Moslehi announced in May that more than 30 U.S. and Israeli spies had been discovered and an Iranian television program, which acts as a front for Iran's government, showed images of internet sites used by the U.S. for secret communication with the spies.

U.S. officials said the Iranian television program showed pictures of people who were not U.S. assets, but the program's video of the websites used by the CIA was accurate.

Some former U.S. intelligence officials say the developments are the result of a lack of professionalism in the U.S. intelligence community.

"We've lost the tradition of espionage," said one former official who still consults for the U.S. intelligence community. "Officers take short cuts and no one is held accountable," he said.

But at the CIA, officials say such risks come with the territory.

"Hezbollah is an extremely complicated enemy," said a U.S. official. "It's a determined terrorist group, a powerful political player, a mighty military and an accomplished intelligence operation, formidable and ruthless. No one underestimates its capabilities."

"If you lose an asset, one source, that's normally a setback in espionage," said Robert Baer, who is considered an expert on Hezbollah. "But when you lose your entire station, either in Tehran or Beirut, that's a catastrophe, that just shouldn't be. And the only way that ever happens is when you're mishandling sources."