The AIG board’s Sunday decision to remove CEO Martin Sullivan and replace him with Bob Willumstad may look like a sudden move. Actually the shift at the top was in the works for a while. This past spring, as AIG’s directors extended a lifeline to Sullivan, who had led the insurance giant ever since the ouster of Maurice “Hank” Greenberg in early 2005, they quietly were talking to Willumstad about taking the chief executive job.

Willumstad, who once headed Citigroup’s global consumer business and became non-executive chairman of AIG in late 2006, had qualms about accepting what is clearly one of the toughest CEO jobs in the FORTUNE 500. That task—turning around an enormously complex company that lost $13.1 billion in the last two quarters—is enough to strike fear in the most ambitious executive, but Willumstad’s other key concern was his obligations to Brysam Global Partners, the private equity firm that he started last year with fellow Citigroup alum Marge Magner. Brysam’s largest investor is JP Morgan Chase , whose CEO Jamie Dimon once worked side by side with Willumstad at Citi .

In the past several weeks, as the extent of AIG’s mortgage-related losses became clearer, the board considered recruiting an outsider such as Jay Fishman, another Citi alum who is now chief executive of Travelers . But AIG’s directors hooked Willumstad, who received Dimon’s assurance that he was fine with the move away from Brysam. “I was more than fine,” says Dimon. “I was supportive. Bob will do a great job at AIG. He’s an exceptional executive. He’s trustworthy. And he knows what complexity is.”

Now at AIG, Willumstad must figure out what businesses to keep and sell. “Nothing is off the table. There will be no sacred cows,” he told investors in a Monday conference call, though he noted that he doesn’t envision breaking up the core insurance business. As for the whole of AIG, he’s making no commitments. This is interesting in light of the fact that late last year, when Willumstad was interviewed for the top post at Citi, he told the CEO search committee that he believed that the board should seriously consider breaking up the company.

Despite his age, 62, and his private-equity leanings, Willumstad is viewing this AIG job as a long-term gig. Meantime, he has a couple of other top-executive holes to plug: the CFO role and the top post in AIG’s financial products group, the source of its largest writedowns.