Most large software companies are involved in offshore development, now small- and medium-sized companies are starting to undertake global sourcing too. Empirical research suggests that offshoring is not always successful; however, only a few comprehensive failure stories have been reported. The objective of our study has been to understand why small and medium-sized companies terminate their offshore outsourcing relationships and what alternative arrangements they undertake afterwards. Therefore, we designed a multiple case study of four medium-sized Scandinavian software companies that have terminated their offshore outsourcing relationships. Our results are based on data collected through semi-structured interviews, informal dialogues and analysis of company documents. We found that all companies terminated their offshore contracts because of low quality of the software being developed. This was caused by an inability to build the necessary human and social capital. The companies reported challenges with domain knowledge, a lack of commitment of external developers, cultural clashes, poor communication and high turnover, which only amplified the problems. After termination all four companies changed their sourcing strategy from offshore outsourcing to offshore insourcing and partnerships. We conclude that successful offshore software development requires a change from a cost-driven focus to an intellectual capital-driven focus. To prevent continuous investments into contracts that are destined to fail, companies should look for signs of escalating commitments and terminate relationships that cannot be corrected. Those companies that choose outsourcing shall also take into account that mismatch between the size of the offshore contract relative to the vendor may have a negative effect on a relationship.