PHILADELPHIA -- Sure, Cole Hamels admitted, there was a part of him that wanted to test free agency, a natural curiosity to find out what his market value really is.

Money is an important part of the equation for any potential free agent. But it's not the only factor. There's also playing in a comfort zone, and having a chance to win. Each player juggles those considerations and prioritizes them differently.

In the end, the Phillies guaranteed their 28-year-old left hander $144 million over six years beginning next season. It's the second-richest contract for a pitcher behind the seven-year $161 millon contract the Yankees gave CC Sabathia in 2008. That clearly mattered. Still, he might have gotten even more if he'd let the situation play out. It seems that the final decision ultimately hinged on his desire to stay -- and try to win -- with the organization that drafted and signed him in 2002.

Or as his wife, Heidi, put it: "He's from California, I'm from Missouri, but this is our home now."

Hamels seemed conflicted about what he wanted in recent weeks. He talked about not being afraid to find out how much he was worth, but he also mentioned growing up in San Diego and rooting for Tony Gwynn and how special it would be to also spend his entire career with the same team. He spoke almost wistfully about how the Phillies had gone to great lengths to make sure that homegrown teammates like Chase Utley, Ryan Howard and Jimmy Rollins didn't get away.

As negotiations heated up, he said, there were incidents that helped crystallize his thinking. One came last Saturday, when he made what everybody knew could be his final start as a Phillie at Citizens Bank Park. As he walked off the mound in the eighth inning, he received a standing ovation and responded by waving his hat to the sellout crowd.

"It really showed me something," he said. "It really did mean a lot. First and foremost, you want to be in the city that wants you, wants you to play, wants to win. That's why we started our foundation here, To give back to the people that accepted us and took us in. We really feel like we've done a lot in the community, and there is so much more we want to do to get our message out."

Hamels, Hedi, their two children, Caleb and Braxton, are among the few Phillies families who live in the area year-round.

Said agent John Boggs: "With his last game pitched here, I think he felt this was really the best place for him to be. I think he consulted with his family, his wife, and they came to the conclusion that when you know the situation that you've been in for so many years and you really want to stay here, that's important."

He was also aware there aren't many destinations with the kind of rabid support the Phillies have at Citizens Bank Park.

"At the end of the day, good game or bad game, you realize that there was a sellout watching every move that you played," he said. "And talking about every move you make and can't wait for the next one. The (more than) 250 straight sellouts is something pretty impressive and I think it will continue for many more to come. I know that's what the organization wants, I know that's what the players want, I know that's what the fans want."

All that still might not have been enough if he didn't believe a Phillies team that has struggled this season after winning five straight division titles was committed to doing whatever it takes to be competitive.

In fact, Hamels and Ruben Amaro Jr. talked about whether this huge commitment would hinder the team from doing what it needed to do to address other needs. "We did have a discussion about it," the general manager said. "We did discuss the fact, the magnitude of the contract, would it hinder us from doing some other things? In some cases it might, but again as I've told him, our goal remains the same, to try to put pieces of the puzzle around these core players to make sure we're a championship caliber club."

Said Hamels: "[The goal] here is to win and to win multiple championships. We got one in '08. As much as I did my part [as NLCS and World Series MVP] I'd still kind of like to do more. It's something to where it went too fast. And that's ultimately where I want to make it happen again, as many times as possible."

Hamels became the third starting pitcher to take potentially less money to either come to or stay with the Phillies in the last few years. Roy Halladay accepted a three-year extension to approve the trade from Toronto, even though he probably could have gotten twice that if he'd become a free agent. And Cliff Lee left money on the table to come back to the Phillies in 2011. Both had lobbied him to stay, and their presence played a role in Hamels' thinking, too.

"Having Doc and Cliff, they are a big part of why I want to be here," he said. "To be with two of the best pitchers in baseball and be able to go out there and have the confidence that you're playing with guys who are the most talented pitchers in baseball. You can learn a lot from them and you can feed off them. And when we get rolling, I think we have the confidence that no one can stop us."

It all added up to the conclusion that the grass isn't always greener elsewhere, that staying where they are was what would make them happiest. "I can't wait to text my doctor and say, 'All the rest of our children will be born in Philadelphia, too," Heidi said.

And that says it all.