Start off by going back to Mustapha, so you'll have to choose a passageway located near the camels. Open your inventory and show your newly acquired knife to Mustapha. You will have to choose new topics from the list - 'Knife' and 'House'. As a result, you will find out that this knife probably belongs to a Turk, chief of the local gang of thieves. End the conversation and go back to the main square. Now you will have to go to your left (screen). This is going to be your first time you've visited that location, so you shouldn't have any problems finding the correct passageway.
Once you've arrived at the new area, proceed towards a large house located in the background. Click on the door and you'll find out that it's locked. Now you will have to click on a lock (screen) in order to initiate a new puzzle. It's going to be a tricky challenge, so you should consider following my instructions closely. Take your time to familiarize yourself with the controls. Note that each time you hover over a ball, you are presented with a few possibilities to move it. Also, sometimes you're going to have to move more than one ball. Use a small red button whenever you need to reset this puzzle.
The result of the puzzle is seen next to the reset button and your objective will be to create an ideal copy. Here are the steps you have to take in order to prevail:
1) Hover over X and move the ball upwards. Three other balls are going to be moved as well.
2) Hover over X and move the ball to your left.
3) Hover over X and move the ball downwards three times. . Three other balls are going to be moved as well.
4) Hover over X and move the ball to your left. One other ball is going to be moved as well.
5) Hover over X and move the ball downwards two times. One other ball is going to be moved as well.
6) Hover over X and move the ball to your right. One other ball is going to be moved as well.