The Northern Ireland international spent last season on loan at Upton Park and was voted as the Players' Player of the Year for his performances that helped the Hammers secure promotion to the Premier League via the play-offs. And the club has confirmed that McCartney has now joined on a permanent basis for the second time after spending two years in east London between 2006 and 2008.
"I am delighted to be coming back to West Ham and this time on a permanent basis," the 31-year-old told the club's official website.
"It was great to be part of the side that won promotion for the club last season. It was a fantastic way to end the campaign last year and I am really looking forward to being back in the Premier League with West Ham."
McCartney began his career at Sunderland but joined the Hammers in 2006 and went on to make more than 70 appearances in his first spell at the club. He returned to the Stadium of Light two years later but fell out of favour under former boss Steve Bruce and was allowed to go out on loan.Meanwhile, West Ham have announced that striker Elliot Lee, midfielders Kieran Sadlier and Jack Powell, and goalkeeper Jake Larkins have been awarded professional contracts by the club but Czech shot-stopper Marek Stech has left by mutual consent.