Danielle Staub -- Settlement Reached in War with Ex

10/4/2010 1:25 PM PDT

Danielle Staub -- Settlement Reached in War with Ex

TMZ has learned ... Danielle Staub has reached a settlement with her ex-husband Kevin Maher -- thus ending a ferocious legal war over allegations that he once raped her with a gun and murdered her dog.

The terms of the settlement are confidential -- but one source close to the case tells us ... "cash was involved in the deal."

As we previously reported, Maher had sued the former "Real Housewives of New Jersey" star for $5 million -- claiming she defamed him by allegedly spreading horrible lies about him to several people and various news outlets.

TMZ spoke with Maher who told us, "The matter was resolved to the satisfaction of both parties." Maher also told us, "It's interesting that the case gets settled the day before Danielle was supposed to be deposed ... it was going to be the worst day of her life."