A foreigner wishing to obtain a Schengen visa must apply at the representation of the competent state. The "competent state" is the state competent for deciding on a visa application, and is a state whose territory constitutes the sole destination of the visit.
If the visit includes more than one destination, the competent state is the one whose territory constitutes the main destination of the visit(s) in terms of the length or purpose of stay.
But if the main destination cannot be established, the responsible state shall be the first state the border of which a foreigner has planned to cross in order to enter the Schengen Area.
If the purpose of the visit is transit, and the transit will take place through only one Member State, the competent state is the Member State concerned. In the case of transit through several Member States, the competent state is the Member State the external border of which the foreigner intends to cross when starting the transit.
If a foreigner requires an airport transit visa, it is issued by the representation of the Member State on whose territory the transit airport is situated. In the case of double or multiple airport transit, the competent state is the Member State whose external border the foreigner has planned to cross in order to enter the Schengen area.