Muhammad II was the third Layzanshah and the sixth Shirvanshah. He was the son of Abu Tahir Yazid. He is often mislabeled as Muhammad III because of sharing same name with Muhammad of Layzan, who was in fact his grandfather and never ruled as Shirvanshah.