Sergeant York

Alvin York (Gary Cooper), a poor young Tennessee hillbilly, is an exceptional marksman, but a ne'er-do-well prone to drinking and fighting, which does not make things any easier for his patient mother (Margaret Wycherly). He changes when he meets winsome Gracie Williams (Joan Leslie), and works night and day at strenuous odd jobs to accumulate the payment for a certain good farm so she'll marry him. On the very day payment is due, he wins the final needed amount at a target-shooting contest, but on being told that the farm has just been sold to his romantic rival, he returns to his dissolute ways.
Late that night, he is struck by lightning during a rainstorm while en route to attack the man who had cheated him. Finding himself outside the meeting house where a revival is going, he goes in and undergoes a religious awakening and vows never to get angry at anyone ever again. He makes amends with the men who cheated him out of the land, and tries to with Gracie.
When the U.S. declares war in World War I, York tries to avoid induction into the Army as a conscientious objector because of his religious beliefs, but is drafted nonetheless. His status as a conscientious objector is rejected since his church has no official standing, and he reluctantly reports to Camp Gordon for basic training. His superiors discover that he is a phenomenal marksman and decide to promote him to corporal.
York still wants nothing to do with the Army and killing. Major Buxton (Stanley Ridges), his sympathetic commanding officer, tries to change York's mind, citing sacrifices made by others all throughout the history of the United States. He gives York a leave to go home and think it over. He promises York a recommendation for his exemption as a conscientious objector if York remains unconvinced.
While York is fasting and pondering, the wind blows his Bible open to the verse "Render therefore unto Caesar the things which are Caesar's; and unto God the things that are God's." York reports back for duty and tells his superiors that he can serve his country, despite not having everything figured out to his satisfaction, leaving the matter in God's hands. York is still ridiculed by some superiors for his beliefs, until he demonstrates his skill in firing his rifle to the surprise of all.
His unit is shipped out to Europe and participates in an attack during the Meuse-Argonne Offensive on October 8, 1918. Pinned down by deadly machine gun fire, the lieutenant orders Sergeant Early (Joe Sawyer) to take some men and try to attack the machine gun nests from behind. York suddenly finds himself the last remaining unwounded non-commissioned officer in the detachment, and is placed in command by Early.
Seeing his comrades being shot down all around him, his self-doubt disappears. He works his way to a position flanking the main enemy trench and, as a sniper, fires individual rifle shots with such devastating effect that the Germans surrender. Then, York forces a captured officer (Charles Esmond) at gunpoint to order the Germans still fighting in another section of the line to also surrender. He and the handful of other survivors end up with 132 prisoners. York becomes a national hero and is awarded the Medal of Honor. When Major Buxton asks him why he did what he did, York explains that he was trying to save the lives of his men.
Arriving in New York City, York receives a ticker tape parade and a key to the city. He is impressed with the Waldorf-Astoria hotel and its indoor electricity. Congressman Cordell Hull guides him through the city and informs him that he has been offered opportunities to commercialize on his fame. York rejects the offers, saying that he was not proud of what he did in the war, but it had to be done. He tells Hull he wants to go home. He returns to Tennessee. The people of his home state have purchased for him the bottomland farm he wanted and paid for a house to be built on the land.

Question: To Which war did York conscientiously object?
Answer: World War I; World War I