If you break the laws of another country, you are subject to the judicial system of that country. Being a foreigner or not knowing the local laws is not an excuse.
Global Affairs Canada can discuss complaints about ill-treatment or discrimination with the local authorities. It cannot, however, ask for special treatment for you, try to spare you from the due process of local law or overrule the decisions of local authorities. Just as a foreign government cannot interfere in Canada’s judicial process, the Government of Canada cannot interfere in the judicial affairs of another country.