WASHINGTON — The State Department gave a crucial green light on Friday to a proposed 1,711-mile pipeline that would carry heavy oil from oil sands in Canada across the Great Plains to terminals in Oklahoma and the Gulf Coast.

The project, which would be the longest oil pipeline outside of Russia and China, has become a potent symbol in a growing fight that pits energy security against environmental risk, a struggle highlighted by last year’s oil spill in the Gulf of Mexico.

By concluding that the $7 billion Keystone XL pipeline would have minimal effect on the environment, President Obama would risk alienating environmental activists, who gave him important support in the 2008 election and were already upset by his recent decisions to expand domestic oil drilling and delay clean air rules. Pipeline opponents have protested in front of the White House for a week, resulting in nearly 400 arrests.

At the same time, rising concerns about the weak economy and high gas prices have made it difficult for the administration to oppose a project that would greatly expand the nation’s access to oil from a friendly neighbor and create tens of thousands of jobs.