BP (NYSE: BP) had always been thought of as a blue chip, a stock you can invest in and not worry. But then the Deepwater Horizon disaster happened, lopping off nearly 40% of the company's value. In dollar terms, that's more than $60 billion of company value, gone in less than three months. Many investors are furious and are wondering if this was foreseeable. So how can you avoid the next BP?

One way
The nonprofit Project on Government Oversight (POGO), founded in 1981, "originally worked to expose outrageously overpriced military spending on items such as a $7,600 coffee maker and a $436 hammer. In 1990, after many successes reforming military spending, including a Pentagon spending freeze at the height of the Cold War, POGO decided to expand its mandate and investigate waste, fraud, and abuse throughout the federal government."

POGO maintains the Federal Contractor Misconduct Database, detailing instances of misconduct from 1995 to the present. Over 15 years, you would expect there to be some instances of misconduct; people are human, after all. What's interesting is to look at the companies with the most instances of misconduct. Here are the top 10:

Rank

Contractor

Instances of Misconduct

Misconduct $ (Since 1995)

Details

No. 1

BP

52

$1,598.8 million

Details

No. 2

Lockheed Martin (NYSE: LMT)

51

$577.3 million

Details

No. 3

ExxonMobil (NYSE: XOM)

51

$2,453 million

Details

No. 4

Boeing (NYSE: BA)

38

$1,591.7 million

Details

No. 5

General Electric (NYSE: GE)

34

$88.7 million

Details

No. 6

Northrop Grumman (NYSE: NOC)

31

$835.1 million

Details

No. 7

Honeywell (NYSE: HON)

31

$641.8 million

Details

No. 8

Chevron

29

$480.1 million

Details

No. 9

University of California

25

$67.3 million

Details

No. 10

Royal Dutch Shell

24

$1,182.8 million

Details

 Source: Federal Contractor Misconduct Database.

BP, Lockheed Martin, and ExxonMobil shared top honors with roughly 50 each. The amazing thing is that these numbers don't include pending cases against the companies, which in BP's and Lockheed's cases total 10 or more.

Lockheed had the largest amount of federal contract dollars for FY 2009: Its misconduct over those 15 years included inflated costs, billing errors, bribery of foreign officials, and environmental violations. Exxon's misconduct included violations regarding the Exxon Valdez disaster, violation of trade embargoes, and violation of environmental regulations.

The lowest dollar amount of misconduct among the companies was GE with $88.7 million: That's a little over five times less than the next-highest in the top 10. GE has consistently been known as one of the top companies in the world, and this is a testament to that. The University of California had the lowest misconduct amount. These mainly stemmed from the Lawrence Livermore National Laboratory and the Los Alamo National Laboratory, the two national labs it runs for the federal government.

Boeing and Northrop Grumman had the second- and third- highest amount of dollars from federal contracts in 2009, respectively. Boeing's misconduct included improper invoicing, Arms Export Control Act violations, illegal hiring, and pollution violations. Northrop's include procurement fraud, mischarges, water contamination, and violations of the Arms Export Control Act. Misconduct at Honeywell, another large contractor, included failure to report hazardous chemical releases, illegal exporting of chemicals, excessive harmful emissions, and labor law violations.

Chevron and Royal Dutch Shell round off the list with environmental and other violations. It's interesting to note that Royal Dutch Shell had only half as many violations as the top three, but its misconduct accounted for a very high dollar amount.

Lesson to be learned
So what can we learn from this?

1. Beware companies that have serious records of mistreating the public trust. This flouting of ethical conventions suggests that such companies will ultimately treat shareholders poorly, too.

2. Diversify. Don't let a BP-like event wreak havoc on your portfolio. It's terrible when you hear stories of people being invested in only one or two stocks and losing all their retirement savings. Don't let this happen to you.

3. Do your homework: BP's atrocious record was available to the public.

What do you think? Is this a real way to avoid the next BP, or just a case of hindsight being 20-20? Let us know in the comments box below.

In June, Fellow Fool Anand Chokkavelu asked some of our top analysts a similar question: "Which company out there seems like a safe investment but isn't?" To see their answers, click here.