In his final pain-racked days, a frail and hunched Gregory Peck hid from the world inside his Bel-Air estate so friends and fans wouldn’t see how age had ravaged his once-dashing good looks.

The 87-year-old screen legend barred even his wife’s closest friends from visiting their home — where, barely able to walk, he spent his last hours enjoying old movies, his art collection and his precious family.

Despite the pain, his last days were filled with many moments of joy, and the great leading man died just as he wanted to — at home with Veronique, his beloved wife of 48 years, clutching his hand.

The end came peacefully at about 4 a.m. on June 12.

“Gregory didn’t feel well that night, and his wife told me she sat with him and held his hand,” the actor’s longtime spokesman

Monroe Friedman told The ENQUIRER in an exclusive interview.

“He looked at her, went to sleep and then passed away quietly.

“Veronique was holding his hand when he died.”

Peck, who won an Oscar for the 1962 drama “To Kill A Mockingbird,” felt blessed to have lived so long. And his mind was sharp till the very end — enabling him to enjoy his grandchildren and phone conversations.

Friedman, who spoke on the phone to “The Guns of Navarone” star just 12 hours before his death, told The ENQUIRER: “Gregory had asked me to help him with a business matter. He thanked me and then said, ‘I better get going. There’s a video I want to look at.’

“He didn’t sound ill. I had no idea it would be the last time I’d speak to him.”

Friends and neighbors told The ENQUIRER that Peck was a warm, friendly man — who happily waved to fans who passed by his home hoping for a glimpse of the Oscar winner.

But in the months before his death, the 6-foot-3 giant of the silver screen suffered from a flare-up of an old back injury and needed help just to walk a few feet. He didn’t want fans and friends to feel bad because of his decrepit state.

“Greg couldn’t even stand up straight and didn’t want anyone to see him,” revealed a friend.

“Veronique, 71, was heartbroken that Greg did not want her to invite their dearest friends over, but she respected his wishes.”

The “Roman Holiday” star still enjoyed visits from his grandchildren.

“He had six grandchildren and there was always a grandchild or two running around the house,” revealed Friedman. “Family gave Gregory his happiness.”

The acclaimed actor died a happy man, say insiders.

Shortly before his death, he was proud to be honored for his enormous achievements by the American Film Institute. He was cheered by flowers sent to him by The ENQUIRER on behalf of his millions of fans, and he never tired of watching his old movies — including his favorite, “Moby Dick.”

A source, who watched the classic film with Peck, revealed: “Even though he was a sick man, he still had a wry sense of humor. Gregory quipped, ‘I was a good-looking guy, wasn’t I?'”