It can be a ligament injury
of the knee joint which is called MPFL. This anchors patella
in center position . If there is any damage then you would need to get MRI
of the knee joint to confirm the diagnosis. if this ligament is found torn you will need a surgical procedure to cure this. If you want any more information then you can send me the MRI report.