In search advertising, brand names are often purchased as keywords by the brand owner or a competitor. We aim to understand the strategic benefits and costs of a firm buying its own brand name or a competitor's brand name as a keyword. We model the effect of search advertising to depend on the presence or absence of a competitor's advertisement on the same results page. We find that the quality difference between the brand owner and the competitor moderates the purchase decision of both firms. Interestingly, in some cases, a firm may buy its own brand name only to defend itself from the competitor's threat. It is also possible that the brand owner, by buying its own branded keyword, precludes the competitor from buying the same keyword. Our result also implies that the practice of bidding on the competitor's brand name creates a prisoner's dilemma, and thus both firms may be worse off, but the search engine captures the lost profits. We also discuss the difference in our results when the search is for a generic keyword instead of a branded keyword. Finally, we find some empirical support for our theory from the observation of actual purchase patterns on Google AdWords.