It has been a terrible month for Indonesia. The lurid spectacle of mass executions by firing squad of seven foreigners and one Indonesian convicted of serious drug offences turned them into victims of a corrupt legal system, while the officials handling the matter all the way up to President Joko Widodo were portrayed as being cruel and insensitive.
There was more trouble stemming from the legal process in Indonesia as two teachers from an international school in Jakarta were convicted of raping students and sentenced to 10 years in prison in a case that has been universally questioned by legal experts.
While many Indonesians applauded the President's resolve and perhaps a majority of them support the death penalty, Indonesia's image overseas has been seriously damaged.
The challenge now is for the fledgling Joko administration to decide how best to manage the situation and restore Indonesia's good name.
This is going to be hard. For one thing, Mr Joko was elected on a platform that promised firm resolve in the defence of sovereignty. This is why, when faced with a storm of protest over the executions and appeals all the way up to the UN Secretary-General for clemency, Mr Joko's stock response was: It is a matter of sovereignty; respect our laws.
Also, Mr Joko's weak political position just months into his presidency meant that he had no choice but to assert his strength of resolve on an issue that would have prompted a tsunami of protest and attacks from within, perhaps leading to his impeachment, if he had wavered.
However, it is simply wrong to believe that a country as large and as important as Indonesia can turn inwards and base all decisions on considerations of domestic politics and popular sentiment. Even China has had to rein in popular sentiment against Japan in order to safeguard its interests.
So what should Mr Joko do to repair the damage?
First, it is important for the President to re-state rather loudly his government's commitment to universal values of human rights and dignity.
He need not make this so obviously related to the executions and the death penalty - which many now think should be reviewed in Indonesia. But he can find an issue or topic worthy of being highlighted. It could be human trafficking and the scourge of modern slavery, which Indonesia also suffers from.
This won't be easy for a President who projects badly on the international stage and seems reluctant to press the flesh with international leaders.
But the fact that the execution controversy raged on throughout a World Economic Forum in Jakarta, the gala anniversary of the Asia-Africa Summit in Bandung and an Asean leaders' summit in Kuala Lumpur without a single effective counterpoint from Mr Joko on his country's defence of universal values spoke badly of his administration's capacity to understand the world.
Second, much of the damage could have been averted by better diplomacy - both quiet and public - so it is critical to make improvements to Indonesia's diplomatic capacity.
Indonesian diplomats should not sit in bunkers and wait for this to blow over, they must go out and proactively repair the damage, demonstrate the country's commitment to principles, and talk openly and honestly about challenge to reform, especially in the legal system. There is really no point in crowing about sovereignty when no one in Indonesia respects or trusts the legal process either.
Finally, Mr Joko himself needs to think again about his posture. His predecessor, Mr Susilo Bambang Yudhoyono, went a long way towards generating goodwill towards Indonesia internationally by projecting bold if over-ambitious stances on global issues; he adhered closely to the vision of Indonesia's founding fathers of a country that gave back to the world in gratitude for the world's support for Indonesia's struggle for independence - a free and active foreign policy.
Dr Yudhoyono was pilloried at home for what were seen as wasteful gestures that did nothing to feed Indonesians. Mr Joko has vowed to focus instead on assisting the welfare of Indonesians overseas, but to do so at the expense of Indonesia's prestige and integrity as a sizeable democratic nation playing a responsible role in global affairs is simply being penny wise and pound foolish.
Arguably, Indonesia can defend the interests of its citizens, protect its sovereignty and, at the same time, do more to roll back the image of being a dark place of repression and violence that has haunted the country since the mid-1960s.
Indonesia is a nation founded on ideals, not interests. It is now time to reassert those ideals and repair the damage to Indonesia's image overseas.
The writer is Asia Regional Director at the Centre for Humanitarian Dialogue based in Singapore.