What is the role of magnesium nitride in ammosamide B synthesis?

The following is a snapshot of the [synthesis of ammosamide B from Synarchive](https://synarchive.com/syn/112):



> 
> [![synthesis of ammosamide B](https://i.stack.imgur.com/hxNRj.png)](https://i.stack.imgur.com/hxNRj.png)
> 
> 
> 


In the final step $\ce{Mg3N2}$ is used to convert esters to amides or amides to amines. What is the mechanism of this process? How does the $\ce{N3-}$ get converted to $\ce{H2O}?$




$\ce{Mg3N2}$ is magnesium nitride. It reacts with $\ce{MeOH}$ to generate magnesium methoxide and ammonia according to online report by Buske [[1](https://cen.acs.org/articles/87/i28/Chemical-Safety-Mg3N2-Hazard.html)].
The $\ce{NH3}$ thus generated is acting as nucleophile to react with the methyl ester to give the primary amide. It also removes two trifluoracetamide groups (or the $\ce{MeO-}$ does) to reveal the amino groups.


Quite why the authors have chosen to use this over more conventional sources of $\ce{NH3}/\ce{MeOH}$ (which is commercially available) is for them to explain.


### Reference


1. [Gary Buske. Chemical Safety: $\ce{Mg3N2}$ Hazard. *Chemical & Engineering News* **2009**, 87 (28).](https://cen.acs.org/articles/87/i28/Chemical-Safety-Mg3N2-Hazard.html)


 3