How to get the first footprint of the selection?

My code is as follows, but this is not the first footprint, it seems to be random

import pcbnew

board = pcbnew.GetBoard()
selected_footprints = [fp for fp in board.GetFootprints() if fp.IsSelected()]

if selected_footprints:
    first_footprint = selected_footprints[0]  
    print(f"first footprint: {first_footprint.GetReference()},postion: {pcbnew.ToMM(first_footprint.GetPosition())}")