Between 1460 and 1864 was Flensburg the second important harbor to Denmark after Copenhagen .
Between 1460 and 1864 , Flensburg was , after Copenhagen , the second biggest port in the Kingdom of Denmark , but passed to the Kingdom of Prussia after the Second Schleswig War in 1864 .