My assumption is a little bit of both but from what I read it may just be a way to stay in ketosis
The weight loss achieved via fasting and a ketogenic diet are caused by a lowering of insulin. When you have high insulin your body will store energy into your adipocytes (fat cells). When you have low insulin you pull energy from them. So Keto + fasting is the best way to lower your basal insulin level which allows your body to obtain its sustenance from your body fat. This results in loss of weight
I’d recommend everyone read the book Good Calorie, Bad Calorie by Gary Taubes. It’s a bit thick, but it walks through this process in depth.