Say what?

My boyfriend just said he's going to leave me after our baby is born & that he'll go to court if I ever tried taking her away? In no way shape or form did I ever think once about taking her away from her father. This shit just came up out of no where. We don't have the best of relationship but it isn't all that bad either. We just annoy each other and are at that phase where we're used to each other. Mind you we're both 20 years old and I already have been looking into nice apartments for us to live in with our newborn babe. I would love to give my daughter what I didn't have as a child growing up , even if I have to do it alone. I just feel like he is starting to doubt our relationship for whatever reason but trying his best not to leave me cause of his baby. It's quite heart breaking . I do not know what to think ...