Soldier Desmond Doss (Andrew Garfield) is a pacifist in one of World War II’s bloodiest battles in “Hacksaw Ridge.” (Mark Rogers/Summit Entertainment)

“Hacksaw Ridge” is a war film of the old school, celebrating nobility, courage and self-sacrifice in the tradition of “The Bridge on the River Kwai,” “Paths of Glory” and “Saving Private Ryan.”

Directed by Mel Gibson with his now-characteristic blend of Christian humanism and fixation with violence and suffering, “Hacksaw Ridge” tells a fascinating, little-known true story of one of the bloodiest battles in the Pacific theater of World War II. It also tips uneasily into spectacle as Gibson’s instincts for bombast and sentimentality take over what could have been a far more powerful film as a straightforward, if brutal, tale of extraordinary physical courage and faith.

The British actor Andrew Garfield plays Desmond Doss, who has grown up as the son of an alcoholic, abusive World War I veteran in a wholesome rural patch of the Blue Ridge Mountains. When the Japanese attack Pearl Harbor, he and his brother enlist, against their traumatized father’s wishes. Desmond’s Seventh-day Adventist faith and past brushes with violence have turned him toward pacifism, so he joins the Army as what he calls a “conscientious cooperator,” meaning he won’t touch or carry a gun but will eagerly do his part as a medic, saving lives on the battlefield.

Teresa Palmer, left, stars as Dorothy Schutte and Garfield as Desmond Doss. (Mark Rogers/Summit Entertainment)

Vince Vaughn stars as Sergeant Howell. (Mark Rogers/Summit Entertainment)

The first hour of “Hacksaw Ridge” gently limns Desmond’s home life, his nascent courtship with a pretty nurse named Dorothy (Teresa Palmer in a radiant breakout performance) and his troubled relationship with his father, a bitter, broken shipwreck of a man played with florid intensity by the superb Hugo Weaving. Once Desmond gets to Fort Jackson, in South Carolina, the film’s tone abruptly shifts: His sergeant is played by none other than Vince Vaughn, who brings deadpan wit to his put-downs of the “ladies” under his watch, giving them mordant nicknames such as Ghoul, Idiot and, for the tall, lanky Desmond, Cornstalk.

Despite his thin build, Desmond proves every bit as strong and resilient as his peers. But his superiors balk when he refuses to pick up a rifle during target practice. After being mercilessly bullied and persecuted, he is facing a probable court-martial, and “Hacksaw Ridge” seems to be turning into a theologically propelled courtroom drama until a neat bit of deus ex machina moves the proceedings to the bloody climax hinted at in the movie’s prologue.

Once the movie gets to that sequence — a prolonged attempt on a Japanese redoubt at Hacksaw Ridge on Okinawa — it becomes a harrowing testament to terror, cruelty, stamina and, finally, spiritual devotion, as Desmond and his fellow soldiers try to survive an onslaught of unimaginable intensity. Gibson never met a wound he didn’t want to gaze at with almost masochistic intensity: His camera can’t turn away, even when a character gives blood at a civilian hospital. On Hacksaw Ridge, he forces the audience to encounter carnage in all of its chaos and suffering: the bullets, the smoke, the flying gravel, the flames, the mutilated bodies, severed heads, maggot-infested corpses and pulverized viscera.

U.S. Army medic Desmond T. Doss. Doss (Andrew Garfield) was a Christian conscientious objector who refused to bear arms during World War II, yet was awarded the Medal of Honor for single-handedly saving the lives of over 75 of his comrades. (  / Lionsgate)

The filmmaker’s insistence on contending with the most appalling realities of war is not just defensible — it’s admirable. But too often, Gibson reverts to slow-motion, swelling-music cliches that aestheticize the violence rather than confront it. The result is a movie that feels like a series of perfectly crafted speeches punctuated by ghastly set pieces — over-insistent when it should be confident, hectoring when it should be subtle. By telling Desmond’s story so graphically, Gibson gets the cake-and-eat-it-too opportunity to valorize a peace-loving hero while indulging his most lurid taste for violence and gore.

Luckily, Desmond himself is not nearly so contradictory, and the fey, almost doe-like Garfield imbues him with an irresistible mix of gentleness and grit. (He is supported by a well-cast troupe of supporting players, who hark back to the one-of-each ensembles of classic wartime dramas.)

“Hacksaw Ridge” winds up being a rousing piece of entertainment that also happens to be an affecting portrait of spiritual faith and simple human decency. Most important, it immortalizes a man that, shockingly, many filmgoers likely have never heard of. Thanks to this stirring introduction, once they have met Desmond Doss, they will never forget him.

R. At area theaters. Contains intense, prolonged, realistically graphic sequences of war violence, including grisly, bloody images. 139 minutes.