In medieval times, the width and depth of the moat dug around a castle helped to determine how well it could fend off attackers. In the modern era, companies have their own moats; the durability of their competitive advantages determines their long-term profitability and stock performance. To invest successfully, we've got to gauge the sturdiness of a company's moat. Let's look at some of different types found on Wall Street.

The relational moat
Many businesses depend heavily on reputation and relationships. These relationship-based industries can often present substantial barriers to entry. For example, it's not easy to break into the insurance brokering business. Customers tend to be loyal to their brokers, and it'd be tough for an unknown upstart to get clients to defect.

Inside Value recommendation Marsh & McLennan (NYSE:MMC) has a moat built on strong relationships. Despite suffering mightily due to a bid-rigging scandal in 2004, Marsh has managed to stem the tide of customer losses.

Marsh's revenue in its risk and insurance services fell by 10% in 2005, dropped another 2% in 2006, and has been flat year to date in 2007. Meanwhile, operating income in the segment has increased from $84 million in 2004 (the year of the scandal) to $677 million in 2006. Thanks to its existing relationships, Marsh could be poised to finally turn the corner.    

High start-up costs
After the dot-com crash, it became nearly impossible for Web start-ups to secure large amounts of financing. As a result, it's almost impossible for any new online startup to go toe-to-toe with Stock Advisor selection Amazon.com (NASDAQ:AMZN), which spent a whopping $662 million in 2006 for technology and content expenses.  

Of course, Wal-Mart (NYSE: WMT) or Target (NYSE:TGT) could spend billions of dollars on their own online operations, if they wanted to, but that's not exactly their core competency. Although new merchant retail sites are started everyday, no one has attempted to do anything on the scale of Amazon; the expenses are just too formidable.

High break-even costs
On a related note, sometimes competitors can be driven away by high break-even costs. For example, because it sells its products so cheaply, Costco (NASDAQ:COST) requires enormous sales per store to make a profit.

Any competitor aiming to match Costco's strategy would have to go toe-to-toe on pricing, too. However, most competitors know they don't have the sales volume to break even on Costco's margins, so they don't even try.

First mover advantage
Sometimes, just being first is enough. For some businesses, like railroads and utility companies, being the incumbent provider is the ultimate competitive advantage.

After all, no one would dare build a railroad track alongside Burlington's (NYSE:BNI) track. In addition to the near-impossibility of obtaining the zoning rights, it'd also be financial suicide to compete with the incumbent. Maybe that's why Berkshire Hathaway (NYSE:BRK-A) (NYSE:BRK-B) chairman Warren Buffett has been buying so much of Burlington's stock lately.

Foolish thoughts
These are just some of the types of moats companies may have. In fact, the best businesses have several different moats working for them. For example, Wal-Mart was the first major retail store in many of its rural markets. This first-mover advantage alone helps ward off many of its competitors.

In addition, it costs a lot of money to open a Wal-Mart sized store, and it requires a lot of volume per store to break even on Wal-Mart's margins. Thus, in many of its markets, Wal-Mart's moat is nearly impenetrable.

When investing, I'd highly advise investors to look for companies with as many different types of moats as Wal-Mart. They're among the firms most likely to protect and grow shareholder value.

Related Foolishness: