There is a striking similarity between Barack Obama and his new nemesis, Sarah Palin - and it's not just that they are both big on basketball. They have equally set out on what Obama likes to call an "improbable journey" that will see one of them make it all the way to the White House on November 4.

In Palin's case, the improbable journey began here: a sprawling wooden compound that looks like a cross between an oversized McDonald's and a prison complex. It occupies a patch of barren ground on the edge of Wasilla, the tiny town in Alaska in which she spent her childhood and cut her political teeth. Above the entrance a banner announces that this is the home of the Wasilla Assembly of God, motto: "To know Him, and to make Him known!"

It was here Palin was baptised, or "saved", as she describes it, and later had her children baptised. It was here she was inducted into the peculiar rituals of her fundamentalist faith - the charismatic preaching, the laying on of hands, the tears and cries of joy of the Pentecostal church. "I grew up in the Wasilla Assembly of God," she once said. "Nothing freaks me out about the worship service."

On the night I visit the church, the congregation is huddled in a group, arms raised or clasped around each other, as the senior pastor, Ed Kalnins, leads them in prayer. "Lord, we know that you have made this church a platform," he exclaims. "You are using the wonderful Governor Palin to get your message of the gospel across."

Pastor Ed, as his flock calls him, moved to Wasilla in 1999 - three years after the town elected Palin as its mayor. What struck him the first time they met, he has said, was that in her eyes religion came first, politics second. He thought to himself: "This person loves Jesus. That's the bottom line. She loves Jesus with everything she has. She is a disciple of the Lord Jesus Christ before she is the mayor. Sarah Palin is the real deal."

Pastor Ed's language may be colourful. But he has put his finger on a central truth about the woman who in two months' time could become the next vice-president of the US. From her earliest days at the bottom of the political ladder in minuscule Wasilla, through to her sudden rise this week into international stardom, she has always been on a mission.

Her trajectory has run in parallel with that of her party. Her career took off precisely at the moment when the Christian right seized control of the Republican movement, casting out the fiscal conservatives who had traditionally held sway with their focus on such worldly matters as low taxes and small government.

The shift in the party's focus from mammon to God is illustrated perfectly in Palin's successful campaign to become mayor in 1996. All previous elections had revolved around such existential questions as how to improve the pavements and get litter off the streets. She ignored all that, campaigning instead against abortion and gun control and casting aspersions on her (Republican) opponent about his infrequent attendance of church.

Victoria Naegele was editor of the local paper, The Frontiersman, at the time and can recall the shock of the Palin revolution. "I remember thinking 'Wow! Are religious issues really germane to the job of being mayor of a town of just 5,000 people?'"

Naegele remembers vividly too a second shockwave that came swiftly after Palin's election. Instead of easing her way into the role, she went in with guns blazing, demanding that six of the department heads of the council - none of them political appointments, several with many years' service - submit their resignations. When Naegele protested through the editorial columns of the paper at what she saw as the new mayor's heavy-handed style, she felt the heat. "It was a difficult time. I was lambasted as a liberal, when in fact I am a Christian conservative Republican, just like Sarah Palin."

Then, in an incident that is fast turning into the stuff of political legend, Palin was revealed earlier this week to have attempted to censor Wasilla's library. The idea is almost laughable when you see the library itself. Its small collection of books includes a prominent section on hunting and fishing, and no visible copies of Lady Chatterley's Lover. Yet in 1996, after parents complained about a book their child had taken home, Palin took umbrage. Frustratingly, no one can remember the volume concerned. What we do know is that Palin turned on the then librarian, Mary Ellen Emmons, asking her in a council meeting what she would do if she were told by the mayor to remove certain books from the collection.

Local resident Anne Kilkenny was in the public gallery and heard the librarian's reaction: "She sucked in her breath, and replied that the books in the library were all acquired in accordance with professional criteria and she would resist completely."

Palin has since claimed her question was purely rhetorical. That is not how Naegele and Kilkenny perceived it at the time. A few weeks later, Palin sent Emmons a letter terminating her employment. "People in the town rose up in anger," Kilkenny recalls. "The library is an important institution in our city, as there's not a lot else to do here in the winter but sit by the fire with a good book. There was real public pressure, and Sarah was forced to rescind the letter."

Emmons survived. Others were less fortunate. The museum director, city planner and public works director all quit within months of Palin's ascendancy, and the police chief was sacked outright (he sued for wrongful dismissal but lost). Palin said the turnover was needed to clean out the "old boys' club". Others were not so sure.

Again, she was utterly in tune with the trajectory of her party. By the end of the 1990s the Republican leadership had adopted a modus operandi that also combined religious zealotry with managerial ruthlessness. Yet this development was not without its detractors within the party. One of the loudest critics was the very man who has put Palin on the national stage: John McCain. Paradoxically, it was partly his disdain for the grip that TV preachers came to hold over the Republicans that earned him a reputation as a maverick.

Since then, Palin has travelled a huge distance in her journey towards the White House. Two years ago she became Alaska's first female governor, with some of the most valuable natural resources in the US under her control. Stylistically, she's become much more sophisticated. But under the surface, the way of operating has changed little.

The religious mission is still front and centre of her politics. She opposes abortion in all cases other than those in which the mother would die if she were to give birth. She is a vocal opponent of gay marriage, and advocate of the teaching of anti-evolutionary creationism, or "intelligent design", in schools.

Her religious beliefs extend to a conviction that the Iraq war is God's will. When she returned to Wasilla in June to pray with her old congregation, she said of the troops being posted to Iraq, including her own son, Track: "Our national leaders are sending them out on a task from God. We have to pray there is a plan and that it's God's plan."

Most poignantly, she will not countenance sex education for teenagers, preferring instead to preach that abstinence is the only complete protection against pregnancy or venereal disease. It would be a cheap shot to suggest that this week's bombshell revelation that her 17-year-old daughter, Bristol, is herself pregnant was Palin's comeuppance.

But it would not be unfair to point out that Alaska has the highest per capita incidence of chlamydia in the country, and that the rate of teenage pregnancies across the US, including within her state, has just risen for the first time in 14 years - a trend many blame on George Bush's preferment of abstinence-only education. "It's frustrating we aren't doing more to inform our children," said Brittany Goodnight of the Alaska branch of Planned Parenthood.

If the religious flame still burns bright, so too does the ruthless determination. In an echo of what happened to the librarian and police chief in Wasilla all those years ago, Palin is embroiled in a full-scale investigation by the Alaskan state legislature into allegations that she sacked the safety commissioner because he in turn refused to act against a police officer whom Palin wanted dismissed.

The officer, Mike Wooten, was the governor's former brother-in-law, who had been through an acrimonious divorce from her sister. Palin, her husband, Todd, and several of her aides tried to convince the commissioner, Walter Monegan, to fire Wooten, but he refused.

The casualties scattered along Palin's path continue to mount. Lyda Green, a neighbour of Palin's in Wasilla, has just become the latest. She is stepping down as a state senator after 14 years.

Green is the leader of the Republicans in the Alaskan senate and an old-style fiscal conservative. She voted against several of the governor's most important initiatives over the past two years, including a move to increase taxes on the big oil and gas companies. Green was surprised by the reprisals that followed. "I found early on that if you disagreed with her it was not taken as a disagreement with policy, but a personal disagreement."

First came the embarrassment of a radio interview between Palin and a local rightwing shock-jock in which the interviewer called Green a bitch and a cancer within the party. Palin's response on air? She laughed.

"She knew I'm a cancer survivor - she sent me flowers," Green says. "That was a very lacklustre moment."

Then Palin arranged for a friend to stand this summer against Green in the Republican party's selection process for her own senate seat. Green decided to stand down rather than go through a primary battle she was sure would be ugly. "There came a point when I thought it was no longer worth it," says Green. "I didn't need, in a community as small as this, to stand in the face of this very popular governor." Then she adds: "But it's not a way to run a government."

That's a pertinent observation, I suggest, in the light of the next destination Sarah Palin hopes to reach in her improbable journey. "It is pertinent," Green replies.

Putin v Palin: who would win in a shoot-out?

American politicians have a long tradition of talking up their expertise with firearms. Most recently, then-hopeful presidential candidate Mitt Romney was caught boasting he'd "been a hunter pretty much all my life" - by which, it turned out, he meant he'd been rabbit shooting twice. But Sarah Palin's claim seems far more justifiable: a lifetime member of the National Rifle Association, she's been caribou hunting on numerous occasions, and footage exists of her firing an A4 assault rifle in Kuwait. She has also taken a close personal interest in "aerial wolf gunning", an Alaskan practice that involves exactly what you'd imagine.

Vladimir Putin's recent tiger-tranquillising triumph, on the other hand, raises numerous questions. It wasn't caught on camera, even though he was with a TV crew, whose lives he reportedly saved, and footage that was released showed another member of the crew explaining how to hold the weapon. Firing a tranquilliser dart is easier, too: there's less kickback. Putin has been photographed brandishing a rifle in the past, but actual instances of shooting seem curiously absent.

Gun enthusiasts swooned over Palin in the US, though some noted the rifle in the Kuwait video appears to be a modified one, equipped with a laser; you can't see the targets, but it's likely she was shooting at a simulator screen. Still, as one of the soldiers can be heard to observe, she's apparently "hitting pretty close to dead centre".

This may not be the most persuasive foreign policy qualification in presidential history, but if Palin had to face Putin in a shoot-out on an ice floe in the Bering Strait, it seems likely she'd win. Unless Dick Cheney was hunting in the vicinity, of course, in which case he'd probably accidentally kill them both.