My job needs protection and so do I.............................Apologies to Neil Young.
A lot of human behavior is not economically efficient. I would argue that much of that behavior has sound logical roots in a science more fundamental than economics, biology. Recently, a certain ferocious Mustelid took on India's failed attempt to protect its incipient solar panel industry. Success, he argued, would only have ensured that Indian purchasers of solar stuff would pay more than they otherwise might. That's very sound and Smith/Ricardo, but history suggests that there is more to the story.
When the dark satanic mills of Manchester were cranking up, they benefited from trade laws that protected them from competition with Indian weavers and later, when their efficiency was sufficient, free trade at the point of a gun allowed those same mills to turn whole villages of Indian weavers into boneyards, and protectionist schemes protected them against competition from the Colonies. Later, protectionism allowed the US, Japan, China and others to build domestic industry behind walls that kept the competition out.
Economists will show you their "theorems" which demonstrate that everyone would have been better off with a more Ricardo efficient allocation of labor, but this ignores a couple of key facts: 1)nations are usually run not for the benefit of everyone, but for the benefit of elites, and 2)in a Darwinian competition, the individual (nation or person) might benefit more by damaging a rival, even at the cost of accepting damage himself rather than by gaining a benefit himself while giving a larger benefit to a rival.
As long as Darwin and Malthus are calling the shots - and, to a significant extent, they still are - doing the best for your country might not be the most economically efficient for the moment. Of course protecting failing industries is a bad idea, the pain you take in the present will just lead to more in the future. In the particular case of solar, it's hard to tell if that's an industry in which India's low cost labor has a future or not, but I'm going to guess that India doesn't really need to compete in most solar power sectors.