Can I claim my nieces and nephews after someone else already did?

I had legal and physical custody of my nieces and nephews for more than half of the year. The agreement with their mother was that I would claim them, but then she went behind my back and claimed them herself. Am I able to claim them now? Also, in transitioning the children back to their mother they would spend a few nights a week with her until she was awarded custody back. However I still had them more overnights than she did, but it’s very close. I’m not sure how I would be able to prove I had them longer besides my custody paperwork.