Battery issue

I have a W541 that I run Debian on. I got a new battery for it, which was working great until for some reason it stopped working. It says charging 99%, and as soon as I unplug it, it shuts down. I’ve tried the old battery, and it exhibits the same behaviour. What could it be?