You will have to see a solicitor and ask that they prepare a statutory declaration stating the position as you have explained above and confirming what your actual name should be and that you are swearing the stat dec with a view to obtaining an amended passport with the correct name.
You then take this to the Moroccan Embassy and ask that they provide you with the relevant forms and procedures for obtaining an amended passport. Once you have this, you will need to write to the UKBA enclosing the passport (send by Royal Mail special delivery), the statutory declaration and a covering letter explaining the position.
You may have difficulties with the UKBA if they consider that they oversight speaks to a dishonesty or some form of fraud, you will therefore have to convince them that the oversight is one of honest and genuine mistake. If they accept that it was an honest mistake then it will not affect your immigration status and the spouses visa will be transferred to your new passport and you will be unaffected.
If this is useful please kindly click accept so that I may be rewarded for my time. You will be free to ask follow up questions.
DISCLAIMER: Answers from Experts on JustAnswer are not substitutes for the advice of an attorney. JustAnswer is a public forum and questions and responses are not private or confidential or protected by the attorney-client privilege. The Expert above is not your attorney, and the response above is not legal advice. You should not read this response to propose specific action or address specific circumstances, but only to give you a sense of general principles of law that might affect the situation you describe. Application of these general principles to particular circumstances must be done by a lawyer who has spoken with you in confidence, learned all relevant information, and explored various options. Before acting on these general principles, you should hire a lawyer licensed to practice law in the jurisdiction to which your question pertains.
The responses above are from individual Experts, not JustAnswer. The site and services are provided “as is”. To view the verified credential of an Expert, click on the “Verified” symbol in the Expert’s profile. This site is not for emergency questions which should be directed immediately by telephone or in-person to qualified professionals. Please carefully read the Terms of Service (last updated February 8, 2012).