By Jenny Gross And Cassell Bryan-Low 

LONDON--British Prime Minister David Cameron said the West needs a tough, long-term response to Russia over tensions in Ukraine, warning that he and other leaders were prepared to take sanctions "to a whole different level" if Moscow ramps up its aggression.

Mr. Cameron discussed sanctions in an exclusive interview Thursday, in which he also addressed his fight to retain his job in what is expected to be a close national election in the U.K. in May and the U.K.'s potential exit from the European Union. Mr. Cameron has promised that if he wins he will negotiate reforms in the country's relationship with Brussels and hold a referendum by 2017 on whether the U.K. should leave the EU.

Speaking during a train ride on the campaign trail, Mr. Cameron said he believes "the right answer" is for the U.K. to remain within a reformed EU but acknowledged he could still end up overseeing Britain's exit from Europe. "You can't stay in an organization if your employer, the British public, doesn't consent to it," the prime minister said.

On events in Ukraine, he said the West must be prepared "to settle in for a long and determined position" of pitting the weight of the U.S. and the EU against Russia.

"If Russia is going to rip up the rule book of the 21st century and destabilize a sovereign country, then the rest of the world should be prepared to say to Russia, 'Well you can't rip up one part of the international rule book while still having access to international markets, international finance, international systems,'" Mr. Cameron said.

His comments follow a video conference held earlier this week between U.S. President Barack Obama, Mr. Cameron and other European leaders. Scattered violence has continued in Ukraine despite last month's cease-fire accord reached in the Belarusian capital of Minsk.

Mr. Cameron said the leaders had agreed on the call to implement tougher sanctions against Russia if the Minsk agreement fails. He added they also were ready to take sanctions "to a whole different level" if there was another incident like that in Debaltseve, the strategic railway hub in Ukraine that pro-Russia rebels overran last month in what Kiev and Western officials called a violation of the cease-fire.

At home, Mr. Cameron is focused on the upcoming election. His center-right Conservative Party is effectively neck-and-neck in opinion polls with the center-left Labour Party, the main opposition. Many analysts expect neither party to win the election outright, which could result in a minority government or a coalition. Mr. Cameron's failure to secure a majority in the 2010 election prompted him to form a coalition with the centrist Liberal Democrats--the U.K.'s first peacetime coalition since the 1930s.

Mr. Cameron said it "is doable" for the Conservatives to win the election but that he wasn't complacent. Mr. Cameron travelled in the first class carriage of a regular train with a small entourage of advisors and security personnel. He sat beside his famous red box--which resembles a sturdy brief case and contains his official documents.

Mr. Cameron wants to focus the election debate on the economy, which experienced a strong recovery in 2014 after years of little or no growth in the wake of the financial crisis. Labour argues many British people have yet to benefit following five years of prices rising faster than wages during the government's austerity drive.

But he has also had to respond to an increasingly vocal public debate on immigration, amid concerns among some British voters about the strain on public services. Mr. Cameron looks set to fall significantly short of fulfilling his promise of reducing net migration to the tens of thousands by the general election.

The prime minister said the government's efforts to reduce immigration from outside of the EU had made an impact, though "not as big an effect as I would like." He also said he has been working to reduce the influx from other EU members by making the U.K.'s welfare system less attractive to other EU citizens, which he said would "have a marked effect."

Also, Mr. Cameron defended Britain's security services following lawmakers' questions over why they failed to apprehend the man Western intelligence officials now believe is Islamic State militant "Jihadi John" after tracking him for years. But he acknowledged that more could be done to combat the threat from foreign fighters.

It emerged last week that Western officials believe Jihadi John, who appears in several videos of Western hostages being killed, to be Mohammed Emwazi--a British man who had been on the radar of U.K. intelligence agents since at least 2009.

The prime minister wouldn't comment on the identity of Jihadi John. "I'm not going to give a running commentary on an individual case where we're in the middle of very hard work with our partners to find and put out of action these sorts of individuals and groups." But, in general, "there's always more that can be done."

He pointed to current government efforts, ranging from trying to de-radicalize young British Muslims to assisting with security in other countries that are vulnerable to terrorist groups. He also said it is crucial that modern technology, such as developments in encryption, doesn't overtake the ability of security forces to intercept discussions between terrorists.

"We should not allow safe spaces--havens--for people to communicate and so we have to, as technology advances, we have to advance our legislation so that we don't give safe spaces," he said.