When you see Jeremy Lin smiling on the court, tongue wagging, it’s not just because his New York Knicks have won five in a row. It’s not just because the Bay Area kid has become an out-of-nowhere national sensation, putting up big numbers night after night.

Lin is smiling, primarily, because he feels like he has been delivered.

“Sometimes you come up against a mountain and you end up making the mountain seem bigger than God,” said Lin, who spoke with this newspaper via phone on the condition that questions be limited to the issue of his spirituality.

Last year when he was playing for the Warriors, “I was on pins and needles. I was putting all this unnecessary pressure on myself. Now, I feel like I’m free out there.”

He can no longer stroll anonymously down the streets of New York, but Lin has found peace. He is bombarded with interview requests (even David Letterman got turned down), yet Lin is experiencing a sense of ease he’s never before felt.

His devout Christianity, bred at the Chinese Church in Christ in Mountain View, has been his guide since he was young. But Lin admits these last few months were a test unlike any before.

Sucker punched by the cold business of the NBA — playing for his third team in a year — Lin suffered in silence. Before he was the talk of the sports world, before he was crowned star of the Knicks, Lin was ridden with doubt and anxiety. So he doubled down on his commitment to God.

And without that, he believes, there would be no Lin-sanity.

What the country sees is a Cinderella story, Lin’s meteoric rise from the NBA Development League to unstoppable star. But for Lin, it’s a story of faith, the beautiful struggle he’s now convinced he can win. Most importantly, it’s a story of how he’ll be completely fine if he doesn’t.

“I’m not playing to prove anything to anybody,” Lin said. “That affected my game last year and my joy last year. With all the media attention, all the love from the fans (in the Bay Area), I felt I needed to prove myself. Prove that I’m not a marketing tool, I’m not a ploy to improve attendance. Prove I can play in this league. But I’ve surrendered that to God. I’m not in a battle with what everybody else thinks anymore.”

It took some time, some rough nights, long prayers and countless Bible studies. Lin confided in his pastor, Stephen Chen.

“It was hard. I could make him no promises,” Chen said. “To trust what God is doing is definitely a lesson that Jeremy is continuing to learn and not to trust in his results.”

The first body blow came Dec. 9. Disappointed in his rookie campaign, which saw him average 2.6 points in 9.8 minutes with the Warriors, Lin said he went all out during the offseason.

But before he ran a drill under new coach Mark Jackson, he was pulled from practice. General manager Larry Riley told Lin he was being waived for business reasons — the Warriors were making a play for the center they desperately needed and were forced to clear salary space.

That didn’t take away the sting.

Two days later, Lin hopped a plane to Houston with a heavy heart after they claimed him off waivers.

The fresh start didn’t do much to help Lin’s anguish. The Rockets had so many guards on the roster, Lin said he couldn’t get reps in practice. In two preseason games with Houston, he totaled 7 minutes, 51 seconds.

“At the time, I was thinking if this doesn’t work out, I maybe needed to take a break from basketball,” Lin said. “I put in four months of training. I felt like I worked harder than anyone else. And now I was fighting for a chance to practice. I was questioning everything.”

On Christmas Eve, it happened again. Lin was waived. Same deal — the team needed to release him so they could throw big money at a big man.

Lin headed back to the Bay Area defeated, but with a renewed purpose. He gave up trying to control everything. He tried to stop worrying.

He started every morning with a devotional before heading to the gym to work out. Whenever the anxiety tried to creep in, he whispered a Bible verse to himself:

And we know that in all things, God works for the good of those who love Him, who have been called according to his purpose. — Romans 8:28

Even with the glittery trappings that can accompany an NBA lifestyle, Lin’s devoutness has always been his compass, friends say.

“In high school, a few of us were known to party on Friday nights after the games. Jeremy was known for teaching the bible to kids and spending time with his family,” said his Palo Alto High teammate Brad Lehman. “None of the usual distractions were an issue for him.”

Three days after being waived by the Rockets, Lin was picked up by the Knicks, just in time for him to join the team in the Bay Area. He suited up and made his Knicks debut at Oracle Arena, playing 1 minute, 27 seconds, missing his only shot.

Certainly no immediate signs of the Lin-sanity to come.

“I was playing garbage minutes the first two to three weeks,” Lin said. “There was definitely a little bit of “what’s going on?” in my prayers.

Lin was eventually sent back to the NBA’s hinterlands — the D-League — for the fourth time in his career. But he wouldn’t stay long. The Knicks brought him back after he logged a triple-double in his first game.

Then, on Feb. 4, at halftime of a home game against New Jersey, injured Knicks star Carmelo Anthony suggested to coach Mike D’Antoni that he play Lin more in the second half.

Lin responded by finishing with 25 points and seven assists in a win.

After that first big game, Lin became a starter. After the second one, he became the talk of the nation. After the third one, he was a Hall of Famer in the making.

“I know he’s a humble guy who works hard every day whether he’s playing 40 minutes or 4 minutes, so that will never change,” said Stephen Curry, his former Warriors teammate.

Now, the Knicks are 5-0 with Lin running the show. He’s gone from having a non-guaranteed minimum contract and sleeping on his brother’s couch to having America’s biggest market now concerned the Knicks can’t pay him enough to keep him.

But even Lin admits the constant struggle he faces. Deep inside he knows it is bigger than him.

“There is so much temptation to hold on to my career even more now,” Lin said. “To try to micromanage and dictate every little aspect. But that’s not how I want to do things anymore. I’m thinking about how can I trust God more. How can I surrender more? How can I bring him more glory?

“It’s a fight. But it’s one I’m going to keep fighting.”