“As a peace-loving nation, Malaysia is committed to maintaining friendly relations with all countries,” Mr. Najib said on Tuesday. “However, protecting our citizens is my first priority, and we will not hesitate to take all measures necessary when they are threatened.”

Mr. Kim, the elder half brother of the North Korean leader, Kim Jong-un, was killed when two women rubbed poison on his face at Kuala Lumpur International Airport, the Malaysian police said. The women, one from Vietnam and one from Indonesia, have been arrested and charged with murder.

The Malaysian police, who conducted an autopsy of Mr. Kim’s body over North Korea’s objections, concluded that he had been poisoned by VX nerve agent, a banned chemical weapon known to be in North Korea’s arsenal. North Korea has suggested that he died of heart failure and accused Malaysia of working with other countries to defame North Korea.

“Once it denied responsibility for the assassination, North Korea had no option but to push back in a tit-for-tat escalation,” Kim Yong-hyun, a professor of North Korean studies at Dongguk University in Seoul, South Korea, said on Tuesday. “Offense is the best defense for the North.”

Preventing the Malaysians from leaving North Korea would also give the government continuing leverage over Malaysia. If the Malaysians had been free to leave, Malaysia could have broken off diplomatic relations without any significant political cost.

That would have led to the closing of the North Korean Embassy, with at least one suspect who has taken refuge there no longer safe from arrest.

The suspect, Kim Uk-il, an employee of the state-owned North Korean airline, Air Koryo, could be arrested if the embassy were closed. A second suspect who the police say may be hiding at the embassy, Ri Ji-u, also known as James, would also be subject to arrest.