Secular leaders consecrating their nations to Mary or her Immaculate Heart, or to the Sacred Heart of Jesus, are actually fairly common and have been practiced in many different places, all with the blessings of the reigning Popes of their day.
Here are some examples from one website that I quickly looked up:
from
http://catholicism.org/the-politics-of-the-sacred-heart.htmlIn 1875, during the course of the Third Carlist War, the Carlist claimant to the Spanish Throne,
Carlos VII, consecrated his ancestral realm to the Sacred Heart. Carlism was always devoted to the Sacred Heart, and its adherents added the image to both the arms and flag of Spain — again, in keeping with St. Margaret Mary Alacoque’s revelation.
On June 7, 1918, in defiance of the law,
Marshal Ferdinand Foch, having allowed the image of the Sacred Heart to be borne on flags and worn by soldiers, privately
consecrated his army to the Sacred Heart at the parish church of Bombom.
...on May 30, 1919,
King Alfonso XIII solemnly consecrated Spain to the Sacred Heart...
On November 22, 1940,
Petain privately consecrated France to the Immaculate Heart of Mary...
On October 27, 1946,
King Mutara III consecrated his country, Rwanda, to Christ the King...
There were many examples of Latin American presidents consecrating their countries to the Virgin of Fatima in the 1950's if I recall correctly. The mere fact that someone is a secular ruler does not mean they have no authority in the eyes of Church, as St. Paul tells us.