Both Sen. Bernie Sanders and former Maryland Gov. Martin O'Malley rushed to applaud President Obama on Friday for his decision to reject the Keystone XL pipeline.

Both O'Malley and Sanders vehemently opposed the pipeline prior to the launches of their respective campaigns. Front-runner Hillary Clinton, on the other hand, refrained from stating her opinion on the pipeline until September, five months into her campaign.

Many speculated that her opposition of the pipeline was an attempt to appease the left-leaning progressive base of the party, which has shown significant support for Sanders.

"Climate change is a global environmental crisis of huge magnitude. It is insane for anyone to be supporting the excavation and transportation of some of the dirtiest fuel on earth. As someone who has led the opposition to the Keystone pipeline from day 1, I strongly applaud the president's decision to kill this project once and for all," Sanders said in a statement made just minutes after the president announced his decision.

Sanders not only opposed the Keystone pipeline on the campaign trail but also during his time in the Senate. O'Malley quickly joined Sanders, praising Obama's actions and promising to continue making environmental progress if elected.

"We have a moral and economic imperative to tackle climate change. Paving the way for something like the Keystone pipeline would be a step backward, and I'm glad to see that President Obama and Secretary Kerry today are rejecting the Keystone permits," O'Malley said.

"I'm the only candidate who is setting a progressive goal of powering our nation by 100 percent renewable energy," he said. "I am also the only candidate who has gotten results — cutting greenhouse gases and creating thousands of clean energy jobs to tackle climate change."

Clinton, Sanders and O'Malley will face off Friday night in the first Democratic primary forum in South Carolina.