I have a Kenyan passport and a Moroccan passport, and I am a student studying in the UK. The Kenyan passport is the only passport out of the two listed that has the British student visa. If I want to travel to Morocco, which passport do I use to get out of the UK, and to get in to Morocco? And which passport to get back into the UK? Is it possible to use the Moroccan passport as a visa at check-in at departure in the UK?
To exit the UK: Use the passport you used to enter the UK. They will probably want to put an exit stamp in your passport and will look for the corresponding entry stamp.
To enter Morroco: Use your Morrocco passport.
To exit Morocco:
To reenter the UK: I'm not familiar with the details of student Visas, but I would use the Kenyan passport with the student Visa since I assume you're reentering on a student status.
I would confirm all of this with the appropriate countries Consular sections before starting my trip.
I would use the Kenyan passport to exit and enter UK, provided the student visa allows this. Moroccan to enter and exit Morocco. This way you have all the required entry/exit stamps.