By David Ingram, Aruna Viswanatha and Oliver Tree

Goldman Sachs Group [NYSE:GS] was handed a victory on Friday after the U.S. Justice Dept. ended its yearlong investigation into allegations the firm bet against the same subprime mortgage-backed securities that it also sold to its clients. 

The Justice Dept. said there was "not a viable basis to bring a criminal prosecution" against the firm or any of its employees, quietly ending years of public scrutiny by regulators over the same subprime mortgage-backed securities Goldman sold to its investors, which later tanked as the economy collapsed.

Separately on Thursday, Goldman said the SEC had dropped an investigation into the firm's role in selling a different $1.3 billion subprime mortgage-related deal arranged in 2006, Reuters reported.

The Justice Dept.'s decision not to prosecute Goldman, a firm held up by critics as a symbol of Wall Street greed during the 2007-2009 financial crisis, highlights the difficulty in prosecuting crisis-related cases.

Few expected the bank to face criminal charges, but in April 2011, U.S. Senator Carl Levin asked for a criminal investigation after the subcommittee he leads spent more than a year looking into Goldman, according to Reuters.

The accusations were aired in a heated 2010 Congressional hearing in which Levin grilled Goldman Chief Executive Lloyd Blankfein for hours about whether it was morally correct for the firm to sell its clients products described internally as "crap."

"The department and investigative agencies ultimately concluded that the burden of proof to bring a criminal case could not be met based on the law and facts as they exist at this time," the Justice Dept. said in a statement late on Thursday.

Neil Barofsky, a former watchdog for the U.S. government's financial system bailout in 2008, said the announcement was a stark reminder that no individual or institution had been held meaningfully accountable for their role in the financial crisis.

"Without such accountability, the unending parade of megabanks scandals will inevitably continue," said Barofsky, who has been an outspoken critic of the government's response to the financial crisis.

In a related civil case, Reuters reported, Goldman settled with the U.S. Securities and Exchange Commission for $550 million in July 2010, without admitting wrongdoing. The SEC is still pursuing a civil complaint against Fabrice Tourre, a Goldman vice president involved in the now-famous "Abacus" deal, which involved the firm choosing and betting against the subprime mortgage-backed securities underlying an investment product named Abacus. The SEC accused Goldman of failing to tell investors about this possible conflict of interest.