This problem was after another one by Július Sunyer (see below). It was published as an original in an article by Jordi Breu, see: “An old problem revisited” The Problemist, May 2009, Vol 22 (3) p.106
Try: Color the knights on d4,e4 and 1.O-O#? but illegal castling!
Solution:Colour the knights on d4,f2 and 1.Kxf2#! All missing pieces were captured by pawns. The wPg5 is the only piece that could capture the light-square bB, so it came from e2 and White never played e2-e3. The bPc5 had to capture the light-square wB; thus Black never played d7-d6. Since all the knights are still on the board, and given the pawn pattern and the facts above, the first capture had to be gxQf6, since the Q is the only piece that could have exited (via c2). All other missing white pieces were captured by the bPb2 on dark squares, including wPs at b2 and c3. The wB initially on c1 had to be taken on d4 or e5, when the wPb2 was still on the board, after c2-c3 and dxe3 had already been played, and the wPh4 was already in its current place. This bishop had to exit via e1-g3 or e1-f2-g1-h2-etc., so the wK had temporarily to leave its home square. Thus, White has lost the right to castle.
Try: Color the knights on d4,e4 and 1.O-O#? but illegal castling!
Solution:Colour the knights on d4,f2 and 1.Kxf2#! All missing pieces were captured by pawns. The wPg5 is the only piece that could capture the light-square bB, so it came from e2 and White never played e2-e3. The bPc5 had to capture the light-square wB; thus Black never played d7-d6. Since all the knights are still on the board, and given the pawn pattern and the facts above, the first capture had to be gxQf6, since the Q is the only piece that could have exited (via c2). All other missing white pieces were captured by the bPb2 on dark squares, including wPs at b2 and c3. The wB initially on c1 had to be taken on d4 or e5, when the wPb2 was still on the board, after c2-c3 and dxe3 had already been played, and the wPh4 was already in its current place. This bishop had to exit via e1-g3 or e1-f2-g1-h2-etc., so the wK had temporarily to leave its home square. Thus, White has lost the right to castle.
Not surprisingly, after my problem was published I found that Dr. Sunyer had also used the same idea in the following #4 (White cannot castle because the wK had to move to make way for the wBc1).