There are sometimes cases where protectionist trade policies are a good thing. (note this is a big debate, so a bit of bias here).
Lets look at an example to make it clear...
Suppose I'm country A and you are country B.
I'm a small country, you are a large one.
My country is 100% agriculture based. Your country is completely diverse and strong in all sectors.
My country realizes it is time to diversify and become more integrated into the global economy/market. Instead of just agriculture based products, my country wants to also sell computer monitors.
Here is where the problem occurs, if my country just starts producing computer monitors and try's to sell them, people will just continue to buy your countries computer monitors because they are better quality and probably cheaper in price due to comparative advantage. So now what? What must my country do to compete with yours, and grow? Well if my country makes your products more expensive, (aka a tariff) less people will buy your monitors and more people will buy mine (only in my country). This would allow my computer monitor(tech) sector to grow on it's own, without a big bully competitor(your country in this scenario) forcing me out before I even get started.
Over time once my tech sector has grown enough to compete with yours, I would lower/get rid of the tariffs and be better off.
Hope this helps you understand.