Hun Sen is preparing for local polls in June and a 2018 national election after clamping down on opposition figures trying to break his 32-year grip on power.
The warning was a reference to opposition protests that broke out during the last election in 2013, when a crowd destroyed at least two police cars over allegations of voter fraud.
The opposition Cambodia National Rescue Party (CNRP) also accused Hun Sen of rigging the poll in his favour and led a months-long protest over the election results.
"Remember, in the 2017 and 2018 (elections), if your group does such activities again, armed forces will crack down on them immediately. If war happens, let it be," he said.
More From This Section
"I still insist that war will happen if the (ruling) Cambodian People's Party isn't in power," he added.
Hun Sen has long maintained that violence would break out if his party were ousted in elections.
The former soldier first took office in 1985, when Cambodia was emerging from the ravages of the genocidal Khmer Rouge regime.
He portrays himself as the only force who can bring stability to the nation.
But there is growing disillusionment at the corruption and political repression associated with Hun Sen's rule, as well as his family's enormous wealth -- boosting opposition groups in recent years.
In the last year the premier has responded with a crackdown on his rivals.
More than a dozen activists and opposition politicians have been thrown in jail since the 2013 election that challenged the ruling party's majority.