Why is this

Earlier I felt constipated and couldn't poop but out of no where. I felt the urge to poop like a feeling in my stomach. When I went to the restroom my poop just slid right out like diarrhea. Sorry for the tmi! Why could this be though earlier it didn't want to come out till now?