HONG KONG — Indonesia’s weekend executions of two foreigners convicted on drug charges have prompted an indignant diplomatic reaction, as Brazil and the Netherlands withdrew their ambassadors and Australia said it would not rule out such a move.

A Dutch citizen, Ang Kiem Soei, and a Brazilian, Marco Archer Cardoso Moreira, were executed early Sunday by firing squad along with convicts from Indonesia, Malawi, Nigeria and Vietnam.

President Dilma Rousseff of Brazil personally appealed to President Joko Widodo of Indonesia to spare the life of Mr. Moreira, who was convicted of smuggling cocaine in 2004. Ms. Rousseff was “distressed and outraged” that the sentence was carried out, according to a statement from the Brazilian president’s press office.

The Netherlands condemned the executions of Mr. Ang, who was convicted in 2003 on the charge of producing ecstasy, and the five others. “My sympathies go out to their families, for whom this brings a dramatic end to years of uncertainty,” the Dutch foreign minister, Bert Koenders, said in a written statement.