The medial habenula relays information from the sensory areas via the interpeduncular nucleus to the periaqueductal gray that regulates animal behavior under stress conditions. Ablation of the dorsal habenula (dHb) in zebrafish, which is equivalent to the mammalian medial habenula, was shown to perturb experience-dependent fear. Therefore, understanding dHb function is important for understanding the neural basis of fear. In zebrafish, the dHb receives inputs from the mitral cells (MCs) of the olfactory bulb (OB), and odors can trigger distinct behaviors (e.g., feeding, courtship, alarm). However, it is unclear how the dHb processes olfactory information and how these computations relate to behavior. In this study, we demonstrate that the odor responses in the dHb are asymmetric and spatially organized despite the unorganized OB inputs. Moreover, we show that the spontaneous dHb activity is not random but structured into functionally and spatially organized clusters of neurons, which reflects the favored states of the dHb network. These dHb clusters are also preserved during odor stimulation and govern olfactory responses. Finally, we show that functional dHb clusters overlap with genetically defined dHb neurons, which regulate experience-dependent fear. Thus, we propose that the dHb is composed of functionally, spatially, and genetically distinct microcircuits that regulate different behavioral programs. Copyright © 2014 Elsevier Ltd. All rights reserved.